locking on the p-threads world
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@984 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
e0c42788c7
commit
072dc0a7b7
16
OPTYap/pthread_locks.h
Normal file
16
OPTYap/pthread_locks.h
Normal file
@ -0,0 +1,16 @@
|
||||
/* ------------------------------- **
|
||||
** Atomic lock for PTHREADS **
|
||||
** ------------------------------- */
|
||||
|
||||
#define INIT_LOCK(LOCK_VAR) pthread_mutex_init(&(LOCK_VAR), NULL)
|
||||
#define DESTROY_LOCK(LOCK_VAR) pthread_mutex_destroy(&(LOCK_VAR))
|
||||
#define TRY_LOCK(LOCK_PTR) pthread_mutex_trylock(&(LOCK_VAR))
|
||||
#define LOCK(LOCK_VAR) pthread_mutex_lock(&(LOCK_VAR))
|
||||
#define UNLOCK(LOCK_VAR) pthread_mutex_unlock(&(LOCK_VAR))
|
||||
|
||||
#define INIT_RWLOCK(X) pthread_rwlock_init(&(X), NULL)
|
||||
#define DESTROY_RWLOCK(X) pthread_rwlock_destroy(&(X))
|
||||
#define READ_LOCK(X) pthread_rwlock_rdlock(&(X))
|
||||
#define READ_UNLOCK(X) pthread_rwlock_unlock(&(X))
|
||||
#define WRITE_LOCK(X) pthread_rwlock_wrlock(&(X))
|
||||
#define WRITE_UNLOCK(X) pthread_rwlock_unlock(&(X))
|
Reference in New Issue
Block a user