Lock type
Direct children types
- ReentrantLock
Re-entrant synchronization lock. Same thread can re-acquire the lock.
Methods
- ==(a:Lock, b:Lock) Source: stdlib.ngs:2830
Defined as a === b Returns
Bool
- acquire(l:Lock) Source: stdlib.ngs:2796
Block till the lock is available and then acquire the lock. Example
l = Lock() ... l.acquire() modify_global_state_safely(...) l.release()
- acquire(l:Lock, cb:Fun) Source: stdlib.ngs:2818
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:2784
Initialize Lock. Creates and initializes pthread_mutex.
- init(c:Cond, name:Str='', lock:Lock=null) Source: autoload/globals/Cond.ngs:5
Initialize Cond
- release(l:Lock) Source: stdlib.ngs:2807
Release the lock Example
l = Lock() ... l.acquire() modify_global_state_safely(...) l.release()