There was an error while loading. Please reload this page.
Locking and synchronizing in Telefrag is rather straightforward and clean:
object thing = new(); // Thing to lock on using (var l = thing.Lock()) { // .... we hold a lock on 'thing' } // and now the lock has been released
To lock the whole scope:
object thing = new(); using var lock = thing.Lock(); // locked until this scope ends
The return value from Lock() is a LockMonitor<T> which acquires the lock and then releases the lock when the LockMonitor is disposed.
Lock()
LockMonitor<T>
Additionally:
ReaderWriterLock
ReaderWriterLockSlim
LockMonitor
LockRead()
LockWrite()
public LockMonitor<T> CustomLock<T>(T object) { return new LockMonitor<T>(object, o => customLockRoutine(o), o => customReleaseRoutine(o)); }