sanei_access.h File Reference

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.
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.


Detailed Description

Interface file for the sanei_access functions.

The idea is to provide some simple locking/unlocking mecanism, which can be used to protect device access from more than one frontend simultaneously.


Function Documentation

void sanei_access_init ( const char *  backend  ) 

Initialize sanei_access.

This function must be called before any other sanei_access function.

Parameters:
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.

Parameters:
devicename - unique part of the lockfile name
timeout - time in seconds to try to set a lock
Returns:
  • SANE_STATUS_GOOD - if the lock has been successfully set
  • SANE_STATUS_ACCESS_DENIED - the lock could not set

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.

Parameters:
devicename - part of the lockfile name, use for sanei_acess_lock()
Returns:
  • SANE_STATUS_GOOD - currently the one and only return value


Generated on Mon Jan 31 21:43:30 2011 for SANEI by  doxygen 1.5.6