8.44. File tom/Lock

class tom.Lock

The abstract lock.

inherits

State supers: State

instance tom.Lock

methods


deferred void
  lock;

Undocumented.


deferred void
  unlock;

Undocumented.


deferred boolean
  tryLock;

Try to lock, and return YES if it succeeded.


Any (result)
  doWhileLocked Block block;

Lock, execute the block, and guarantee to unlock.

class tom.SimpleLock

A simple lock is a binary lock.

inherits

State supers: Lock

instance tom.SimpleLock

variables

pointer lock;

The underlying lock.

methods


void
  dealloc;

Undocumented.


id
  init;

Designated initializer.


void
  lock;

Undocumented.


void
  unlock;

Undocumented.


boolean
  tryLock;

Undocumented.

class tom.RecursiveLock

A recursive lock is a binary lock which can be obtained multiple times by the same thread.

inherits

State supers: Lock

instance tom.RecursiveLock

variables

pointer lock;

The underlying lock.

methods


void
  dealloc;

Undocumented.


id
  init;

Designated initializer.


void
  lock;

Undocumented.


void
  unlock;

Undocumented.


boolean
  tryLock;

Undocumented.

class tom.Semaphore

A semaphore is a lock which can be locked a number of times (1 for a binary semaphore) before the next attempt to lock will block.

When allocated first, the first lock will block.

inherits

State supers: Lock

methods


instance (id)
  new int num;

Return a new Semaphore, the first num lock operations will succeed.

instance tom.Semaphore

variables

pointer sem;

Pointer to the underlying structure.

methods


void
  dealloc;

Undocumented.


id
  init int num;

Designated initializer.


id
  init;

Another initializer.


void
  lock;

Undocumented.


void
  unlock;

Undocumented.


boolean
  tryLock;

Undocumented.