diff options
author | Determinant <ted.sybil@gmail.com> | 2019-06-22 01:04:36 -0400 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2019-06-22 01:04:36 -0400 |
commit | 95257d41d0b946197093ad67657fb3d4f7f9030f (patch) | |
tree | 48986fe06085b83e45c633da0be97e586be722c7 /include/salticidae/event.h | |
parent | 729eb87a12bb0efd3c2a4cc381f39e13dfd4fbf9 (diff) |
update C API; fix bugs
Diffstat (limited to 'include/salticidae/event.h')
-rw-r--r-- | include/salticidae/event.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/include/salticidae/event.h b/include/salticidae/event.h index d3625d5..b243865 100644 --- a/include/salticidae/event.h +++ b/include/salticidae/event.h @@ -528,13 +528,11 @@ class MPSCQueueEventDriven: public MPSCQueue<T> { public: MPSCQueueEventDriven(): - wait_sig(true), - fd(eventfd(0, EFD_NONBLOCK)) {} - - ~MPSCQueueEventDriven() { - ev.clear(); - close(fd); + wait_sig(true), + fd(eventfd(0, EFD_NONBLOCK)) { + if (fd == -1) throw SalticidaeError(SALTI_ERROR_FD); } + ~MPSCQueueEventDriven() { close(fd); } template<typename Func> void reg_handler(const EventContext &ec, Func &&func) { @@ -585,13 +583,11 @@ class MPMCQueueEventDriven: public MPMCQueue<T> { public: MPMCQueueEventDriven(): - wait_sig(true), - fd(eventfd(0, EFD_NONBLOCK)) {} - - ~MPMCQueueEventDriven() { - evs.clear(); - close(fd); + wait_sig(true), + fd(eventfd(0, EFD_NONBLOCK)) { + if (fd == -1) throw SalticidaeError(SALTI_ERROR_FD); } + ~MPMCQueueEventDriven() { close(fd); } // this function is *NOT* thread-safe template<typename Func> |