Handler guard object to safely run and finish stream handlers. More...
#include <cvb/async/stream_handler_base.hpp>
Public Types | |
using | StreamHandlerBasePtr = std::shared_ptr< StreamHandlerBase< STREAMTYPE > > |
Shared pointer of the stream handler. | |
Public Member Functions | |
StreamHandlerGuard (StreamHandlerBasePtr streamHandler, AutoRun autoRun=AutoRun::No) noexcept | |
Creates a stream handler guard object. More... | |
~StreamHandlerGuard () | |
Finishes the shared stream handler . More... | |
Handler guard object to safely run and finish stream handlers.
STREAMTYPE | Type of stream to be taken care of. |
This guard class provides a way to safely stop the stream when leaving the scope (e.g an exception occurs).
|
inlineexplicitnoexcept |
Creates a stream handler guard object.
[in] | streamHandler | Stream handler shared by the guard. |
[in] | autoRun | Run the stream handler if yes and not already running, otherwise do nothing. |
Does | not throw any exception. |
|
inline |
Finishes the shared stream handler .
Does | not throw any exception. |
All errors occurred within the acquisition thread are shallowed.