-
Notifications
You must be signed in to change notification settings - Fork 0
/
messagedispatch.h
36 lines (27 loc) · 962 Bytes
/
messagedispatch.h
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
// Copyright: (C) 2016 ESIMTEK ALL RIGHTS RESERVED
// author: Yonghua Zheng
#ifndef __MESSAGEDISPATCH_H
#define __MESSAGEDISPATCH_H
class MessageDispatch
{
private:
static MessageDispatch* dispatcher;
int mesgfd[2];
bool inited;
bool poll(int timeout);
public:
MessageDispatch();
virtual ~MessageDispatch();
bool ready() { return inited; }
void post(const char* message);
int read(char* message, int length, int timeout = -1);
int fd() { return mesgfd[0]; }
#if 0
static void Instantiate();
static void Dispose();
static MessageDispatch* Instance();
static void Post(const char *message);
static int Get(char *message, int length, int timeout = -1);
#endif
};
#endif