Critical Sections


Typedefs

typedef ix_cs_s ix_cs_t
 critical section structure, the pointer to this structure is handle

Enumerations

enum  ix_cs_e { IX_CS_FAST, IX_CS_RECURSIVE, IX_CS_ERROR }
 type of critical sections More...

Functions

ix_cs_tix_cs_new (ix_cs_e cs_type)
int ix_cs_enter (ix_cs_t *pcs)
int ix_cs_tryenter (ix_cs_t *pcs)
int ix_cs_leave (ix_cs_t *pcs)
int ix_cs_free (ix_cs_t *pcs)

Detailed Description

This module describes the methods to create and handle critical sections.

It is mainly a wrapper of pthreads critical sections.


Enumeration Type Documentation

enum ix_cs_e

type of critical sections

Enumerator:
IX_CS_FAST  same thread blocks if cs is already locked
IX_CS_RECURSIVE  same thread can enter if cs is already locked (non portable)
IX_CS_ERROR  same thread returns with error if cs is already locked (non portable)


Function Documentation

int ix_cs_enter ( ix_cs_t pcs  ) 

enters the critical section and blocks till it becomes available

Parameters:
pcs handle to critical section
Returns:
  • 0: OK
  • <0: Error

int ix_cs_free ( ix_cs_t pcs  ) 

frees memory of critical section

Parameters:
pcs handle to critical section
Returns:
  • 0: OK
  • <0: Error

int ix_cs_leave ( ix_cs_t pcs  ) 

leave the critical section

Parameters:
pcs handle to critical section
Returns:
  • 0: OK
  • <0: Error

ix_cs_t* ix_cs_new ( ix_cs_e  cs_type  ) 

constructor, allocate a new critical section

Parameters:
cs_type type of critical section to construct
Returns:
  • handle
  • NULL: error

int ix_cs_tryenter ( ix_cs_t pcs  ) 

tries to enter the critical section, it returns if not available

Parameters:
pcs handle to critical section
Returns:
  • 0: OK
  • <0: Error
  • 1: not available


Generated on 4 Mar 2014 for ixtools by  doxygen 1.4.7