|void||sanei_access_init (const char *backend)|
|Initialize sanei_access. |
|SANE_Status||sanei_access_lock (const char *devicename, SANE_Word timeout)|
|Set a lock. |
|SANE_Status||sanei_access_unlock (const char *devicename)|
|Unlock a previously set lock. |
The idea is to provide some simple locking/unlocking mecanism, which can be used to protect device access from more than one frontend simultaneously.
|void sanei_access_init||(||const char *||backend||)|
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,|
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()|