| 43 | } |
| 44 | |
| 45 | EventDispatcher::~EventDispatcher() { |
| 46 | Stop(); |
| 47 | Join(); |
| 48 | if (_event_dispatcher_fd >= 0) { |
| 49 | close(_event_dispatcher_fd); |
| 50 | _event_dispatcher_fd = -1; |
| 51 | } |
| 52 | if (_wakeup_fds[0] > 0) { |
| 53 | close(_wakeup_fds[0]); |
| 54 | close(_wakeup_fds[1]); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | int EventDispatcher::Start(const bthread_attr_t* thread_attr) { |
| 59 | if (_event_dispatcher_fd < 0) { |