Salome HOME
PR: first version from Antony GEAY, with directory restructuration
[modules/yacs.git] / src / bases / SemaphorePT.cxx
1 #include "SemaphorePT.hxx"
2
3 using namespace YACS::BASES;
4
5 SemaphorePT::SemaphorePT(int initValue)
6 {
7   sem_init(&_semDesc, 0, initValue);
8 }
9
10 SemaphorePT::~SemaphorePT()
11 {
12   sem_destroy(&_semDesc);
13 }
14
15 void SemaphorePT::post()
16 {
17   sem_post(&_semDesc);
18 }
19
20 void SemaphorePT::wait()
21 {
22   sem_wait(&_semDesc);
23 }
24
25 int SemaphorePT::getValue()
26 {
27   int val;
28   sem_getvalue(&_semDesc,&val);
29   return val;
30 }