#include <Semaphores.h>
Collaboration diagram for PLearn::CountEventsSemaphore:
Public Member Functions | |
CountEventsSemaphore (int nb_semaphores=1) | |
construct given number of semaphores for event counters | |
CountEventsSemaphore (SemId semid) | |
access an existing semaphore | |
void | signal (int type=0) |
Signal the occurence of event of given "type", where type can range from 0 to n_semaphores-1. | |
void | wait (int n_occurences, int type=0) |
int | value (int type=0) |
return current value of counter for given "type" of event | |
void | setValue (int value, int resource=0) |
set value of counter | |
~CountEventsSemaphore () | |
release the semaphore upon destruction of object | |
Protected Attributes | |
SemId | id |
semaphore id provided by the operating system at construction | |
bool | owner |
true if this process is the owner of the semaphore, i.e | |
int | n_semaphores |
there can be several semaphores in the same object |
|
construct given number of semaphores for event counters
Definition at line 137 of file Semaphores.cc. References PLearn::endl(), n_semaphores, PLERROR, and PLearn::semun::val. |
|
access an existing semaphore
Definition at line 160 of file Semaphores.cc. References n_semaphores, and PLERROR. |
|
release the semaphore upon destruction of object
Definition at line 215 of file Semaphores.cc. References PLearn::endl(), owner, PLERROR, and PLearn::semun::val. |
|
set value of counter
Definition at line 206 of file Semaphores.cc. References PLERROR, and PLearn::semun::val. |
|
Signal the occurence of event of given "type", where type can range from 0 to n_semaphores-1. No waiting. Definition at line 173 of file Semaphores.cc. References PLERROR. |
|
return current value of counter for given "type" of event
Definition at line 185 of file Semaphores.cc. References PLearn::semun::val. |
|
Wait for n_occurences of event of given "type" to have occured, where "type" can range from 0 to n_semaphoes-1. When this occurs, the event count for this type of event is reset to 0. Definition at line 191 of file Semaphores.cc. References PLERROR. |
|
semaphore id provided by the operating system at construction
Definition at line 133 of file Semaphores.h. |
|
there can be several semaphores in the same object
Definition at line 136 of file Semaphores.h. Referenced by CountEventsSemaphore(). |
|
true if this process is the owner of the semaphore, i.e the semaphore will be released with this object is deleted Definition at line 134 of file Semaphores.h. Referenced by ~CountEventsSemaphore(). |