Simple File/Folder Lock Management

This group contains the definition of a GWEN_FSLOCK. More...

Defines

#define GWEN_FSLOCK_CBID_IO   "GWEN_FSLOCK_CBID_IO"
#define GWEN_FSLOCK_TIMEOUT_FOREVER   (-1)
#define GWEN_FSLOCK_TIMEOUT_NONE   (0)

Typedefs

typedef GWEN_FSLOCK GWEN_FSLOCK

Enumerations

enum  GWEN_FSLOCK_RESULT {
  GWEN_FSLock_ResultOk = 0, GWEN_FSLock_ResultError, GWEN_FSLock_ResultTimeout, GWEN_FSLock_ResultBusy,
  GWEN_FSLock_ResultNoLock, GWEN_FSLock_ResultUserAbort
}
enum  GWEN_FSLOCK_TYPE { GWEN_FSLock_TypeUnknown = 0, GWEN_FSLock_TypeFile, GWEN_FSLock_TypeDir }

Functions

GWENHYWFAR_API void GWEN_FSLock_free (GWEN_FSLOCK *fl)
GWENHYWFAR_API GWEN_FSLOCK_RESULT GWEN_FSLock_Lock (GWEN_FSLOCK *fl, int timeout)
GWENHYWFAR_API GWEN_FSLOCKGWEN_FSLock_new (const char *fname, GWEN_FSLOCK_TYPE t)
GWENHYWFAR_API GWEN_FSLOCK_RESULT GWEN_FSLock_Unlock (GWEN_FSLOCK *fl)

Detailed Description

This group contains the definition of a GWEN_FSLOCK.

The files in this group provide a very simple lock mechanism. When a file is to be locked a lockfile is created exclusively. If this lockfile can not be created exclusively (because it already exists) the file is assumed to be locked. This group can lock files and folders. For folders the lockfile name consists of the foldername plus "/.dir.lck", for files it is the filename plus ".lck". This only works if you have write-access to the folder or, if locking a file, to the folder containing the file to be locked.


Define Documentation

#define GWEN_FSLOCK_CBID_IO   "GWEN_FSLOCK_CBID_IO"

Definition at line 53 of file fslock.h.

#define GWEN_FSLOCK_TIMEOUT_FOREVER   (-1)

Definition at line 56 of file fslock.h.

#define GWEN_FSLOCK_TIMEOUT_NONE   (0)

Definition at line 55 of file fslock.h.


Typedef Documentation

typedef struct GWEN_FSLOCK GWEN_FSLOCK

Definition at line 59 of file fslock.h.


Enumeration Type Documentation

enum GWEN_FSLOCK_RESULT

Enumerator:
GWEN_FSLock_ResultOk 
GWEN_FSLock_ResultError 
GWEN_FSLock_ResultTimeout 
GWEN_FSLock_ResultBusy 
GWEN_FSLock_ResultNoLock 
GWEN_FSLock_ResultUserAbort 

Definition at line 68 of file fslock.h.

enum GWEN_FSLOCK_TYPE

Enumerator:
GWEN_FSLock_TypeUnknown 
GWEN_FSLock_TypeFile 
GWEN_FSLock_TypeDir 

Definition at line 61 of file fslock.h.


Function Documentation

GWENHYWFAR_API void GWEN_FSLock_free ( GWEN_FSLOCK fl  ) 

GWENHYWFAR_API GWEN_FSLOCK_RESULT GWEN_FSLock_Lock ( GWEN_FSLOCK fl,
int  timeout 
)

This function tries to acquire a lock for the given file/folder. It waits if necessary (using GWEN_WaitCallback) while waiting. This function enters and leaves the waitcallback GWEN_FSLOCK_CBID_IO.

Parameters:
fl fslock object
timeout timeout in milliseconds (special values are GWEN_FSLOCK_TIMEOUT_NONE (which does not wait at all) and GWEN_FSLOCK_TIMEOUT_FOREVER (which waits forever).

GWENHYWFAR_API GWEN_FSLOCK* GWEN_FSLock_new ( const char *  fname,
GWEN_FSLOCK_TYPE  t 
)

GWENHYWFAR_API GWEN_FSLOCK_RESULT GWEN_FSLock_Unlock ( GWEN_FSLOCK fl  ) 

This function removes a lock.

Parameters:
fl fslock object


Generated on Thu Nov 9 22:06:50 2006 for gwenhywfar by  doxygen 1.5.1