TerraLib 4.1
TeSemaphore Class Reference

Inter process communication semaphore. More...

#include <TeSemaphore.h>

List of all members.

Public Member Functions

 TeSemaphore (unsigned int count)
 Creates an unnamed semaphore.
 TeSemaphore (unsigned int count, const std::string &semName)
 Creates an named semaphore.
 ~TeSemaphore ()
 Default destructor.
void post ()
 Increments the semaphore's counter.
void wait ()
 Wait the semaphore's counter to become zero.
bool wait (unsigned int waitingTime)
 Wait the semaphore's counter to become zero.

Protected Attributes

std::string semName_

Detailed Description

Inter process communication semaphore.

Author:
Emiliano F. Castejon <castejon@dpi.inpe.br>

Constructor & Destructor Documentation

TeSemaphore::TeSemaphore ( unsigned int  count)

Creates an unnamed semaphore.

Parameters:
countSemaphore initial counter value.
TeSemaphore::TeSemaphore ( unsigned int  count,
const std::string semName 
)

Creates an named semaphore.

Parameters:
countSemaphore initial counter value.
semNameSemaphore name.
Note:
Creates a new semaphore or opens an existing semaphore that can be shared among processes.
TeSemaphore::~TeSemaphore ( )

Default destructor.


Member Function Documentation

void TeSemaphore::post ( ) [inline]

Increments the semaphore's counter.

bool TeSemaphore::wait ( unsigned int  waitingTime)

Wait the semaphore's counter to become zero.

Parameters:
waitingTimeThe maximum waiting time in milliseconds ( 0 == INFINITE ).
Returns:
true if the semaphore's counter is zero or false if the waiting time has finished or an error occurred.
void TeSemaphore::wait ( ) [inline]

Wait the semaphore's counter to become zero.

Note:
If the semaphore's value is greater than zero, then the decrement proceeds, and the function returns, immediately. If the semaphore currently has the value zero, then the call blocks until either it becomes possible to perform the decrement.

Member Data Documentation

This instance name


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines