blob: 32d8ca23d3a512936c9f1ca42ec74da992931a0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*******************************************************************************
* Copyright (C) ST-Ericsson SA 2011
* License terms: 3-clause BSD license
******************************************************************************/
#ifndef _CSEMAPHORE_H
#define _CSEMAPHORE_H
#include <pthread.h>
#include <semaphore.h>
#include "CWaitableObject.h"
class CSemaphore : public CWaitableObject
{
public:
CSemaphore(unsigned int initial_count = 0);
virtual ~CSemaphore();
bool Release(unsigned int count = 1);
DWORD Wait(DWORD timeout = INFINITE);
private:
#if defined(__APPLE__)
sem_t *m_semaphore;
#elif defined(__linux__)
sem_t m_semaphore;
#endif
};
#endif /* _CSEMAPHORE_H */
|