include/razorback/lock.h File Reference

Locking functions. More...

#include <razorback/visibility.h>
#include <razorback/types.h>
#include <pthread.h>
#include <semaphore.h>
Include dependency graph for lock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Mutex
 Mutex Control Structure. More...
struct  Semaphore
 Semaphore Control Structure. More...

Defines

#define MUTEX_MODE_NORMAL   0
 None recursively lockable mutex.
#define MUTEX_MODE_RECURSIVE   1
 Recursively lockable mutex.

Functions

SO_PUBLIC struct MutexMutex_Create (int mode)
 Create a mutex.
SO_PUBLIC bool Mutex_Lock (struct Mutex *mutex)
 Lock a mutex.
SO_PUBLIC bool Mutex_Unlock (struct Mutex *mutex)
 Unlock a mutex.
SO_PUBLIC void Mutex_Destroy (struct Mutex *mutex)
 Destroy a mutex.
SO_PUBLIC struct SemaphoreSemaphore_Create (bool shared, unsigned int value)
 Create a semaphore.
SO_PUBLIC bool Semaphore_Post (struct Semaphore *sem)
 Post to a semaphore.
SO_PUBLIC bool Semaphore_Wait (struct Semaphore *sem)
 Wait for a slot on the semaphore.
SO_PUBLIC bool Semaphore_TimedWait (struct Semaphore *sem)
SO_PUBLIC void Semaphore_Destroy (struct Semaphore *sem)
 Destroy a semaphore.

Detailed Description

Locking functions.


Function Documentation

SO_PUBLIC struct Mutex* Mutex_Create ( int  mode  )  [read]

Create a mutex.

Parameters:
mode One of MUTEX_MODE_NORMAL or MUTEX_MODE_RECURSIVE
Returns:
A new mutex structure or NULL on error.
SO_PUBLIC void Mutex_Destroy ( struct Mutex mutex  ) 

Destroy a mutex.

Parameters:
mutex The mutex to destroy.
SO_PUBLIC bool Mutex_Lock ( struct Mutex mutex  ) 

Lock a mutex.

Parameters:
mutex The mutex to lock.
Returns:
true on success false on failure.
SO_PUBLIC bool Mutex_Unlock ( struct Mutex mutex  ) 

Unlock a mutex.

Parameters:
mutex The mutex to unlock.
Returns:
true on success false on failure.
SO_PUBLIC struct Semaphore* Semaphore_Create ( bool  shared,
unsigned int  value 
) [read]

Create a semaphore.

Parameters:
shared True if share, false if not.
value Initial count.
Returns:
A new semaphore structure or NULL on error.
SO_PUBLIC void Semaphore_Destroy ( struct Semaphore sem  ) 

Destroy a semaphore.

Parameters:
sem The semaphore to destroy.
SO_PUBLIC bool Semaphore_Post ( struct Semaphore sem  ) 

Post to a semaphore.

Parameters:
sem The semaphore to post to.
Returns:
true on success false on failure.
SO_PUBLIC bool Semaphore_Wait ( struct Semaphore sem  ) 

Wait for a slot on the semaphore.

Parameters:
sem The semaphore to wait on.
Returns:
true on success false on failure.
 All Data Structures Files Functions Variables Enumerations Enumerator Defines
Generated on Sun Dec 9 04:00:11 2012 for RazorbackAPI by  doxygen 1.6.3