blob: ff832ac1a54b24a35d6a91317a03e4fdadec2a58 (
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
32
33
34
35
36
37
38
39
40
41
|
#ifndef __ASURA_CONDITIONAL_H__
#define __ASURA_CONDITIONAL_H__
#include <asura-utils/classes.h>
#include "mutex.h"
#include "semaphore.h"
namespace_begin(AsuraEngine)
namespace_begin(Threading)
///
///
///
class Conditional
{
public:
Conditional();
~Conditional();
void Signal();
void Broadcast();
bool Wait(Mutex* mutex, int timeout = ASURA_MUTEX_MAXWAIT);
private:
Mutex m_Mutex;
Semaphore m_WaitSem;
Semaphore m_DoneSem;
int m_Waiting;
int m_Signals;
};
namespace_end
namespace_end
#endif
|