Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Semaphore.h File Reference

#include <pthread.h>
#include <semaphore.h>
#include <stlib/Object.h>

Include dependency graph for Semaphore.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  OS

Defines

#define _REENTRANT
#define _critical(mutex, guardedBlock)
 This macro should simplify critical sections handling.


Define Documentation

#define _critical mutex,
guardedBlock   ) 
 

Value:

_ensure( \
        mutex->wait(); \
        guardedBlock \
    , \
        mutex->signal() \
    )
This macro should simplify critical sections handling.

It uses mutex given as first argument to guard commands given in second. Mutex will unlock on the end of the section even if guarded commands fail with an exception.
Example:

	Semaphore *mutex = Semaphore::forMutualExclusion();
	_critical (
            // Mutex to use
	    mutex
        ,
	    // Commands to evaluate inside mutex guarded section
	);
    

Definition at line 69 of file Semaphore.h.

#define _REENTRANT
 

Definition at line 28 of file Semaphore.h.


Generated on Mon Nov 27 09:50:15 2006 for Smalltalk like C++ Class Library by  doxygen 1.4.2