SANEI 1.3.1.72-4c77c
|
Interface file for the sanei_access functions. More...
Go to the source code of this file.
Functions | |
void | sanei_access_init (const char *backend) |
Initialize sanei_access. More... | |
SANE_Status | sanei_access_lock (const char *devicename, SANE_Word timeout) |
Set a lock. More... | |
SANE_Status | sanei_access_unlock (const char *devicename) |
Unlock a previously set lock. More... | |
Interface file for the sanei_access functions.
The idea is to provide some simple locking/unlocking mechanism, which can be used to protect device access from more than one frontend simultaneously.
void sanei_access_init | ( | const char * | backend | ) |
Initialize sanei_access.
This function must be called before any other sanei_access function.
backend | - backend name, who uses this lib |
SANE_Status sanei_access_lock | ( | const char * | devicename, |
SANE_Word | timeout | ||
) |
Set a lock.
The function tries to open/create exclusively a lock file in $PATH_SANE_LOCK_DIR. If the file could be created successfully, the function fills in the process ID. The complete filename of the lockfile is created as follows: $PATH_SANE_LOCK_DIR/LCK..<devicename> If the lock could not be set, the function tries it until the timeout period has been elapsed.
devicename | - unique part of the lockfile name |
timeout | - time in seconds to try to set a lock |
SANE_Status sanei_access_unlock | ( | const char * | devicename | ) |
Unlock a previously set lock.
The function tries to unlock a previously created lock. The lockfile will be closed and removed.
devicename | - part of the lockfile name, use for sanei_acess_lock() |