Semaphore


Typedefs

typedef ix_sem_s ix_sem_t

Enumerations

enum  ix_sem_e { IX_SEM_LOCAL = 0x01, IX_SEM_GLOBAL = 0x02, IX_SEM_FD = 0x03 }

Functions

ix_sem_tix_sem_new (int id, ix_sem_e mode)
int ix_sem_v (ix_sem_t *psem)
int ix_sem_p (ix_sem_t *psem)
int ix_sem_free (ix_sem_t *psem)

Detailed Description

Interprocess locking.

Typedef Documentation

typedef struct ix_sem_s ix_sem_t

semaphore class


Enumeration Type Documentation

enum ix_sem_e

mode of semaphore

Enumerator:
IX_SEM_LOCAL  semaphore local
IX_SEM_FD  use descriptor of open file as id, i.e. file locking


Function Documentation

int ix_sem_free ( ix_sem_t psem  ) 

free memory and locks

Returns:
  • 0: ok
  • !0: error

ix_sem_t* ix_sem_new ( int  id,
ix_sem_e  mode 
)

Creates new semaphore with file-locking fcntl-call.

Parameters:
id unique id
mode global or local semaphore. IX_SEM_GLOBAL: lockfile is opened in ix_global_path()/sem (otherwise ix_path()/sem)
Returns:
  • handle
  • NULL: Error

int ix_sem_p ( ix_sem_t psem  ) 

Enter semaphore: paseer = betreten, enter critical section

Returns:
  • 0: ok
  • !0: Error

int ix_sem_v ( ix_sem_t psem  ) 

Leave semaphore: verlaat = verlassen, leave critical section

Returns:
  • 0 ok
  • !0 Error


Generated on 4 Mar 2014 for ixtools by  doxygen 1.4.7