23 std::promise<std::streamsize> bytes_promise;
24 std::async(std::launch::async, [
this, &bytes_promise] {
42 get_string() + std::string(
": events has to be either EV_READ or EV_WRITE"));
45 bytes_promise.set_value(
m_bytes);
50 return bytes_promise.get_future();
59 if (
nullptr == worker) {
static std::shared_ptr< dispatcher > instance()
std::string get_string() const
static void add_async_event(event e)
Add an event to the workers queue from a different thread context.
bool exec_in_worker_ctx(task_func_t f)
virtual bool handle_event(worker *worker, int events)
virtual void dispose(worker *worker=nullptr)
void set_exception(tasks_exception &e)
Set an exception to report an error.
std::shared_future< std::streamsize > op()
disk_io_task(int fd, int events, tools::buffer *buf)