Airframe Application Utilities
libairframe 0.7.2 API documentation

Main Page | Data Structures | File List | Data Fields | Globals

airlock.h File Reference

Airframe lockfile interface. More...

#include <airframe/autoinc.h>

Go to the source code of this file.


Data Structures

struct  _AirLock
 A lock structure. More...

Defines

#define LOCK_ERROR_DOMAIN   g_quark_from_string("airframeLockError")
 GError domain for lock errors.
#define LOCK_ERROR_LOCK   1
 A lock could not be acquired.
#define AIR_LOCK_INIT   { NULL, 0, FALSE }
 Convenience initializer for AirLock structures.

Typedefs

typedef _AirLock AirLock
 A lock structure.

Functions

gboolean air_lock_acquire (AirLock *lock, const char *path, GError **err)
 Acquire a lock.
void air_lock_release (AirLock *lock)
 Release an acquired lock.
void air_lock_cleanup (AirLock *lock)
 Free storage used by an AirLock structure.

Detailed Description

Airframe lockfile interface.

Used to acquire lockfiles compatible with the Airframe filedaemon.


Typedef Documentation

typedef struct _AirLock AirLock
 

A lock structure.

Must be maintained by a caller from lock acquisition to release. Should be initialized by AIR_LOCK_INIT or memset(0) or bzero().


Function Documentation

gboolean air_lock_acquire AirLock lock,
const char *  path,
GError **  err
 

Acquire a lock.

Creates a lockfile and returns TRUE if the lockfile was created (and is now held).

Parameters:
lock AirLock structure to store lockfile information in.
path path of file to lock (without .lock extension).
err an error descriptor
Returns:
TRUE if lockfile created, FALSE if lock not available

void air_lock_cleanup AirLock lock  ) 
 

Free storage used by an AirLock structure.

Does not free the structure itself.

Parameters:
lock AirLock to free

void air_lock_release AirLock lock  ) 
 

Release an acquired lock.

Parameters:
lock AirLock structure filled in by air_lock_acquire()