Airframe Application Utilities
libairframe 2.12.0 API documentation

Data Structures | Macros | Typedefs | Functions
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...
 

Macros

#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 struct _AirLock AirLock
 A lock structure. More...
 

Functions

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

Detailed Description

Airframe lockfile interface.

Used to acquire lockfiles compatible with the Airframe filedaemon.

Typedef Documentation

◆ AirLock

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

◆ air_lock_acquire()

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
lockAirLock structure to store lockfile information in.
pathpath of file to lock (without .lock extension).
erran error descriptor
Returns
TRUE if lockfile created, FALSE if lock not available

◆ air_lock_cleanup()

void air_lock_cleanup ( AirLock lock)

Free storage used by an AirLock structure.

Does not free the structure itself.

Parameters
lockAirLock to free

◆ air_lock_release()

void air_lock_release ( AirLock lock)

Release an acquired lock.

Parameters
lockAirLock structure filled in by air_lock_acquire()