OpenGL Vizserver Reference Page


NAME
vsLock - A mutual exclusion lock

HEADER FILE
#include <vizserver/vsLock.h>

PUBLIC METHOD SUMMARY

   Creation and destruction
vsLock (  );
~vsLock (  );
vsLock ( const vsLock& copy);

   Usage
vsBool lock (  );
vsBool trylock (  );
vsBool unlock (  );

   Queries
vsBool isLocked (  );

CLASS DESCRIPTION
This class implements a locking mechanism that is usable with vsThread. This lock implementation allows for recursive locking, releasing the physical lock only when the lock() and unlock() calls balance out for the locking thread.

Limitations
There may be system imposed limits on the number of locks allocable to a process (so don't use them with abandon).

METHOD DESCRIPTIONS

   vsLock()
vsLock (  );

Creates a vsLock.

   vsLock()
vsLock ( const vsLock& copy);

Creates a copy of an existing vsLock.

   ~vsLock()
~vsLock (  );

Destroys this vsLock. If a thread is currently waiting for the lock, the results are undefined.

   isLocked()
vsBool isLocked (  );

Returns TRUE if the calling thread is holding the lock.

   lock()
vsBool lock (  );

Blocks the calling thread until the physical lock is acquired. Returns TRUE unless an error occurs.

   trylock()
vsBool trylock (  );

Attempts to acquire the lock. If the lock is not currently held, then this function returns TRUE. Otherwise, the thread is not blocked and FALSE is returned.

   unlock()
vsBool unlock (  );

Releases the lock, returning TRUE unless an error occurs.

SEE ALSO
vsThread