Coconut Framework  beta
CNLock.h
Go to the documentation of this file.
1 
8 #ifndef CNLock_H
9 #define CNLock_H
10 
11 #include <pthread.h>
12 
16 struct CNLock {
18  pthread_mutex_t mutex ;
19 } ;
20 
25 static inline void
26 CNInitLock(struct CNLock * dst)
27 {
28  pthread_mutex_init(&(dst->mutex), NULL) ;
29 }
30 
35 static inline void
36 CNDestroyLock(struct CNLock * dst)
37 {
38  pthread_mutex_destroy(&(dst->mutex)) ;
39 }
40 
45 static inline void
46 CNLock(struct CNLock * src)
47 {
48  pthread_mutex_lock(&(src->mutex)) ;
49 }
50 
55 static inline void
56 CNUnlock(struct CNLock * src)
57 {
58  pthread_mutex_unlock(&(src->mutex)) ;
59 }
60 
61 #endif /* CNLock_H */
pthread_mutex_t mutex
Definition: CNLock.h:18
Object for mutex operation.
Definition: CNLock.h:16
static void CNLock(struct CNLock *src)
Mutex lock.
Definition: CNLock.h:46
static void CNDestroyLock(struct CNLock *dst)
Release the resource for lock.
Definition: CNLock.h:36
static void CNUnlock(struct CNLock *src)
Mutex unlock.
Definition: CNLock.h:56
static void CNInitLock(struct CNLock *dst)
Initialize lock.
Definition: CNLock.h:26