16 lines
195 B
Go
16 lines
195 B
Go
|
module sync
|
||
|
|
||
|
#include <pthread.h>
|
||
|
struct Mutex {
|
||
|
mutex C.pthread_mutex_t
|
||
|
}
|
||
|
|
||
|
fn (m Mutex) lock() {
|
||
|
C.pthread_mutex_lock(&m.mutex)
|
||
|
}
|
||
|
|
||
|
fn (m Mutex) unlock() {
|
||
|
C.pthread_mutex_unlock(&m.mutex)
|
||
|
}
|
||
|
|