18 #ifndef INCLUDED_THREADUTIL
19 #define INCLUDED_THREADUTIL
25 #define LOCK_MUTEX(_mutex) STMT( \
26 printf("pthread_mutex_lock: 1 %p [pid:%d]\n", _mutex, pthread_self()); \
27 pthread_mutex_lock(_mutex); \
28 printf("pthread_mutex_lock: 2 %p [pid:%d]\n", _mutex, pthread_self()) \
30 #define UNLOCK_MUTEX(_mutex) STMT( \
31 pthread_mutex_unlock(_mutex); \
32 printf("pthread_mutex_unlock: %p [pid:%d]\n", _mutex, pthread_self()) \
37 #define LOCK_MUTEX(_mutex) pthread_mutex_lock(_mutex)
38 #define UNLOCK_MUTEX(_mutex) pthread_mutex_unlock(_mutex)
117 #endif // INCLUDED_THREADUTIL
Locks a CMutex over this object's lifetime.
A non-recursive mutual exclusion lock.
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
#define LOCK_MUTEX(_mutex)
void SetMainThread()
Set the current thread as the 'main' thread.
#define UNLOCK_MUTEX(_mutex)
int pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *)
CScopeLock(CMutex &mutex)
CScopeLock(pthread_mutex_t *mutex)
bool IsMainThread()
Returns whether the current thread is the 'main' thread (i.e.
int pthread_mutex_destroy(pthread_mutex_t *m)
pthread_mutex_t * m_Mutex