A fast mutex implementation for POSIX and Win32. More...
#include "_nvwa.h"
#include "c++11.h"
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
Go to the source code of this file.
Classes | |
class | nvwa::fast_mutex |
Class for non-reentrant fast mutexes. More... | |
class | nvwa::fast_mutex_autolock |
An acquistion-on-initialization lock class based on fast_mutex. More... | |
Namespaces | |
namespace | nvwa |
Defines | |
#define | NVWA_USE_CXX11_MUTEX 0 |
#define | _FAST_MUTEX_CHECK_INITIALIZATION 1 |
Macro to control whether to check for initialization status for each lock/unlock operation. | |
#define | _FAST_MUTEX_ASSERT(_Expr, _Msg) |
Macro for fast_mutex assertions. | |
#define | __VOLATILE volatile |
Macro alias to `volatile' semantics. |
A fast mutex implementation for POSIX and Win32.
#define __VOLATILE volatile |
Macro alias to `volatile' semantics.
Here it is truly volatile since it is in a multi-threaded (POSIX threads) environment.
#define _FAST_MUTEX_ASSERT | ( | _Expr, | |||
_Msg | ) |
if (!(_Expr)) { \ fprintf(stderr, "fast_mutex::%s\n", _Msg); \ abort(); \ }
Macro for fast_mutex assertions.
Real version (for debug mode).
#define _FAST_MUTEX_CHECK_INITIALIZATION 1 |
Macro to control whether to check for initialization status for each lock/unlock operation.
Defining it to a non-zero value will enable the check, so that the construction/destruction of a static object using a static fast_mutex not yet constructed or already destroyed will work (with lock/unlock operations ignored). Defining it to zero will disable to check.
#define NVWA_USE_CXX11_MUTEX 0 |