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 ...

AutoLock AutoLock AutoLock

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 ? ()

Operators

AutoLock = ( Param other )

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


AutoLock AutoLock.clone? ()

clone method

Operators in detail

AutoLock = ( Param other )