ThreadSchedule 3.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
threadschedule::advanced::error_handled_task< Func > Class Template Reference

Callable wrapper that catches exceptions and routes them to an error_handler. More...

#include <error_handler.hpp>

Public Member Functions

 error_handled_task (Func func, std::shared_ptr< error_handler > handler, std::string description="")
 
void operator() ()
 

Detailed Description

template<typename Func>
class threadschedule::advanced::error_handled_task< Func >

Callable wrapper that catches exceptions and routes them to an error_handler.

error_handled_task wraps an arbitrary callable Func and invokes it inside a try / catch block. Any exception thrown by the callable is captured into a task_error and forwarded to the associated error_handler; the exception is not re-thrown, so from the caller's perspective the task completes normally (silently succeeds).

Template Parameters
FuncCallable type. Must be invocable with operator()() (no arguments, return value is discarded).
Ownership
The error_handler is held via std::shared_ptr, making it safe to copy or move error_handled_task across thread boundaries without lifetime issues.
See also
make_error_handled_task

Definition at line 215 of file error_handler.hpp.

Constructor & Destructor Documentation

◆ error_handled_task()

template<typename Func >
threadschedule::advanced::error_handled_task< Func >::error_handled_task ( Func  func,
std::shared_ptr< error_handler handler,
std::string  description = "" 
)
inline

Definition at line 218 of file error_handler.hpp.

Member Function Documentation

◆ operator()()

template<typename Func >
void threadschedule::advanced::error_handled_task< Func >::operator() ( )
inline

Definition at line 224 of file error_handler.hpp.

References threadschedule::task_error::capture().


The documentation for this class was generated from the following file: