include/razorback/lock.h File Reference
Locking functions.  
More...
#include <razorback/visibility.h>
#include <razorback/types.h>
#include <pthread.h>
#include <semaphore.h>
Go to the source code of this file.
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:
- 
  
  
- 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.