NeoPZ
TPZSemaphore.h
Go to the documentation of this file.
1 
6 #ifndef TPZSEMAPHOREHPP
7 #define TPZSEMAPHOREHPP
8 
9 #include "pz_pthread.h"
10 
16 {
17 private:
19  int fCounter;
21  pthread_mutex_t fMutex;
23  pthread_cond_t fCond;
24 
25 public:
27  TPZSemaphore(void);
29  ~TPZSemaphore(void);
31  TPZSemaphore(int initCount);
32 
33  void Wait();
34  void Post();
35 };
36 
37 #endif
Implements semaphore to threads. Utility.
Definition: TPZSemaphore.h:15
pthread_cond_t fCond
Condition for the thread must to be waiting.
Definition: TPZSemaphore.h:23
int fCounter
Counter of the times the semaphore is locked.
Definition: TPZSemaphore.h:19
~TPZSemaphore(void)
Default destructor.
pthread_mutex_t fMutex
Mutex for the thread.
Definition: TPZSemaphore.h:21
TPZSemaphore(void)
Default constructor.