![]() |
O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
|
Provide a convenient RAII-style mechanism to access mutex-protected resources. More...
#include <pthread.h>
Go to the source code of this file.
Macros | |
#define | O2sLockGuard |
Automatically unlock the mutex at the end of the current scope. |
Functions | |
pthread_mutex_t * | o2s_mutex_lock (pthread_mutex_t *mutex) |
Lock the mutex, logging any error. | |
void | o2s_mutex_unlock (pthread_mutex_t *const *mutex) |
Unlock the mutex, logging any error. |
Provide a convenient RAII-style mechanism to access mutex-protected resources.
Definition in file mutex.h.
#define O2sLockGuard |
Automatically unlock the mutex at the end of the current scope.
In a situation where one wants to declare a mutex in a local scope, this "typedef" can be used for that mutex to be unlocked automatically when the variable goes out of scope.
It means this "typedef" can only be used like this: