asio C++ library

PrevUpHomeNext

io_context::work

(Deprecated: Use executor_work_guard.) Class to inform the io_context when it has work to do.

class work
Member Functions

Name

Description

get_io_context

Get the io_context associated with the work.

get_io_service

(Deprecated: Use get_io_context().) Get the io_context associated with the work.

work

Constructor notifies the io_context that work is starting.

Copy constructor notifies the io_context that work is starting.

~work

Destructor notifies the io_context that the work is complete.

The work class is used to inform the io_context when work starts and finishes. This ensures that the io_context object's run() function will not exit while work is underway, and that it does exit when there is no unfinished work remaining.

The work class is copy-constructible so that it may be used as a data member in a handler class. It is not assignable.

Requirements

Header: asio/io_context.hpp

Convenience header: asio.hpp


PrevUpHomeNext