disp_x11.h
1008 Bytes
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
42
43
44
#ifndef __disp_x11_h__
#define __disp_x11_h__
#include "canvas_x11.h"
#include "../dispatcher.h"
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
class disp_x11 : public dispatcher {
private:
int working;
struct sembuf work;
struct sembuf no_work;
public:
canvas_x11* a;
disp_x11(event_source* w) : dispatcher(w) {
working=semget(IPC_PRIVATE, 1, IPC_CREAT);
work.sem_num=0;
work.sem_op=-1;
work.sem_flg=0;
no_work.sem_num=0;
no_work.sem_op=1;
no_work.sem_flg=0;
}
disp_x11(disp_x11& d) : dispatcher(d) {}
~disp_x11() {
semctl(working, 0, IPC_RMID, NULL);
}
void go(void);
void trigger_event(event);
};
class disp_x11_factory : public dispatcher_factory {
public:
dispatcher* create(event_source* es) const {
return new disp_x11(es);
}
};
#endif // __disp_x11__