forked from lxyfirst/id_server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheventfd_handler.h
More file actions
47 lines (32 loc) · 722 Bytes
/
Copy patheventfd_handler.h
File metadata and controls
47 lines (32 loc) · 722 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
45
46
/*
*
* Author : lixingyi (lxyfirst@163.com)
*/
#ifndef EVENTFD_HANDLER_H_
#define EVENTFD_HANDLER_H_
#include <tr1/functional>
#include "io_handler.h"
namespace framework
{
class base_reactor ;
class eventfd_handler : public io_handler
{
public:
typedef std::tr1::function<void (int64_t) > callback_type ;
public:
eventfd_handler() ;
virtual ~eventfd_handler() ;
int init(base_reactor& reactor,const callback_type& callback) ;
void fini() ;
int notify(int64_t count=1) ;
protected:
void on_read(int fd) ;
void on_write(int fd) ;
void on_error(int fd) ;
private:
callback_type m_callback ;
base_reactor* m_reactor ;
int m_event_fd ;
} ;
}
#endif