16 m_io.reset(
new ev_io);
17 ev_init(
m_io.get(), tasks_event_callback<ev_io*>);
29 tdbg(
get_string() <<
": setting events to " << events << std::endl);
38 if (!ev_is_active(
m_io.get())) {
40 ev_io_start(loop,
m_io.get());
48 if (ev_is_active(
m_io.get())) {
50 ev_io_stop(loop,
m_io.get());
60 bool active = ev_is_active(
m_io.get());
62 ev_io_stop(loop,
m_io.get());
66 ev_io_start(loop,
m_io.get());
virtual void dispose(worker *worker)
Stop the watcher before being deleted.
std::unique_ptr< ev_io > m_io
virtual void init_watcher()
Initialize the watcher.
int events() const
Return the monitored events.
virtual void update_watcher(worker *worker)
Udate a watcher in the context of the given worker.
bool exec_in_worker_ctx(task_func_t f)
bool m_watcher_initialized
virtual void stop_watcher(worker *worker)
Stop a watcher in the context of the given worker.
virtual void start_watcher(worker *worker)
Start a watcher in the context of the given worker.
void set_events(int events)
Update the events the object monitors.
std::string get_string() const
virtual io_base & iob()=0
Return the io_base object.
ev_io * watcher() const
Return the io watcher object.