AutoLock (struct)¶
Automatically acquires and releases a lock, upon its construction and destruction. The AutoLock is intended to be created as a local variable, whose scope is the same as the need for a lock.
To localize the scope of an AutoLock, add an additional code block:
... thread-safe code ...
{
AutoLock lock( this.myLock );
... thread unsafe code (critical section) ...
}
... thread-safe code ...
Members¶
Ref<SimpleLock> | simpleLock |
Methods¶
AutoLock ( in AutoLock other ) | |
AutoLock ( in Ref<SimpleLock> simpleLock ) | |
AutoLock ( in Ref<SimpleLock> simpleLock, in Scalar maxWaitSeconds ) | |
AutoLock () | |
AutoLock | clone ? () |
Methods in detail¶
AutoLock ( in AutoLock other )
copy constructor
AutoLock ( in Ref<SimpleLock> simpleLock )
Acquires the lock. The lock will be released at the destruction of the AutoLock.
AutoLock ( in Ref<SimpleLock> simpleLock, in Scalar maxWaitSeconds )
Acquires the lock with a specific maximum delay (overrides lock’s default) The lock will be released at the destruction of the AutoLock.
AutoLock ()
default constructor
clone method