In file thread/gmutex.hh:

class abstractsemaphore

Abstract class to manage a semaphore.

Inheritance:


Public Fields

rdlock
read lock
wrlock
write lock

Public Methods

virtual ~abstractsemaphore ()
Default destructor.
virtual void lock ()
Semaphore lock function.
virtual void readlock ()
Semaphore lock function.
virtual void writelock ()
Semaphore lock function.
virtual void unlock ()
Semaphore unlock function.
virtual bool trylock (locktype lck = rdlock)
Semaphore trylock function.
virtual bool trylock_timed (int timeout, locktype lck = rdlock)
Semaphore trylock function.

Public

typedef enum locktype
type of lock

Documentation

This class is used as an abstract base class for mutex and locks.

typedef enum locktype
type of lock

rdlock
read lock

wrlock
write lock

virtual ~abstractsemaphore()
Abstract virtual destructor.
Returns:
void

virtual void lock()
Locks the semaphore (abstract virtual method).
Returns:
void

virtual void readlock()
Locks the semaphore to allow read access (abstract virtual method).
Returns:
void

virtual void writelock()
Locks the semaphore to allow wrire access (abstract virtual method).
Returns:
void

virtual void unlock()
Unlocks the semaphore (abstract virtual method).
Returns:
void

virtual bool trylock(locktype lck = rdlock)
Tries to lock the semaphore (abstract virtual method). The return argument indicates whether the semaphore was successfully locked, or whether the semaphore was already taken by somebody else.
Returns:
true if semaphore locked
Parameters:
lck - Lock type

virtual bool trylock_timed(int timeout, locktype lck = rdlock)
Tries to lock the semaphore within the given time. The return argument indicates whether the semaphore was successfully locked, or whether the semaphore was already taken by somebody else. This routine will try to lock the mutex 11 times, sleeping 1/10 of the specified timeout everytime the lock fails.
Returns:
true if semaphore locked
Parameters:
timeout - Timeout in usec
lck - Lock type


Direct child classes:
readwritelock
mutex
Author:
DS, November 98
See Also:
Mutex objects

alphabetic index hierarchy of classes


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++