summaryrefslogtreecommitdiff
path: root/source/api_wrappers/linux/CSemaphore.h
blob: 24af4adfa8ea5d9a888631c83a19a514642121ee (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
/*******************************************************************************
 * 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:
    sem_t m_semaphore;
};

#endif /* _CSEMAPHORE_H */