Lock type
Direct children types
- ReentrantLock
Re-entrant synchronization lock. Same thread can re-acquire the lock.
Methods
- acquire(l:Lock) Source: stdlib.ngs:1045
Block till the lock is avaiable and then acquire the lock. Example
l = Lock() ... l.acquire() modify_global_state_safely(...) l.release()
- acquire(l:Lock, cb:Fun) Source: stdlib.ngs:1067
Call cb with lock l held. Releases the lock after cb returns or throws. Example
l = Lock() ... l.acquire(F() { modify_global_state_safely(...) })
- init(l:Lock) Source: stdlib.ngs:1033
Initialize Lock. Creates and initializes pthread_mutex.
- release(l:Lock) Source: stdlib.ngs:1056
Release the lock Example
l = Lock() ... l.acquire() modify_global_state_safely(...) l.release()