mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
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)
|
||
|
}
|
||
|
|