Lock type
Direct children types
- ReentrantLock
Re-entrant synchronization lock. Same thread can re-acquire the lock.
Methods
- acquire(l:Lock) Source: stdlib.ngs:2549
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:2571
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:2537
Initialize Lock. Creates and initializes pthread_mutex.
- release(l:Lock) Source: stdlib.ngs:2560
Release the lock Example
l = Lock() ... l.acquire() modify_global_state_safely(...) l.release()