...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
Class to inform the
when it has work to do.
Get the io_context associated with the work.
Constructor notifies the io_context that work is starting.
Destructor notifies the io_context that the work is complete.
The work class is used to inform the
when work starts and finishes. This ensures that the
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.