-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtrigger.h
More file actions
44 lines (30 loc) · 732 Bytes
/
trigger.h
File metadata and controls
44 lines (30 loc) · 732 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 TRIGGER_H
#define TRIGGER_H
#include "file_descriptor.h"
#include "context.h"
#include <sys/epoll.h>
class reactor;
class trigger : public basic_context {
public:
explicit trigger(int); // takes ownership
trigger(const file_descriptor &); // dups
~trigger();
int fd() const;
int dup() const;
basic_context * wait_for_read();
basic_context * wait_for_write();
basic_context * wait_for_error();
basic_context * wait_for_nothing();
basic_context * wait_for_anything();
bool readable() const;
bool writable() const;
basic_context * fire();
bool armed() const;
private:
void arm();
void disarm();
file_descriptor fd_;
struct epoll_event ev_;
reactor * r_;
};
#endif//TRIGGER_H