ThreadSchedule 1.0.0
Modern C++ thread management library
|
Future wrapper that provides error callback support. More...
#include <error_handler.hpp>
Public Member Functions | |
FutureWithErrorHandler (std::future< T > future) | |
FutureWithErrorHandler (FutureWithErrorHandler const &)=delete | |
auto | operator= (FutureWithErrorHandler const &) -> FutureWithErrorHandler &=delete |
FutureWithErrorHandler (FutureWithErrorHandler &&)=default | |
auto | operator= (FutureWithErrorHandler &&) -> FutureWithErrorHandler &=default |
auto | on_error (std::function< void(std::exception_ptr)> callback) -> FutureWithErrorHandler & |
Attach an error callback. | |
auto | get () -> T |
Get the result, calling error callback if exception is thrown. | |
void | wait () const |
Wait for the future to complete. | |
template<typename Rep, typename Period> | |
auto | wait_for (std::chrono::duration< Rep, Period > const &timeout_duration) const |
Wait for the future with timeout. | |
template<typename Clock, typename Duration> | |
auto | wait_until (std::chrono::time_point< Clock, Duration > const &timeout_time) const |
Wait until a specific time point. | |
auto | valid () const -> bool |
Check if the future is valid. |
Future wrapper that provides error callback support.
Extends std::future with the ability to attach error callbacks.
Definition at line 198 of file error_handler.hpp.
|
inlineexplicit |
Definition at line 201 of file error_handler.hpp.
|
inline |
Get the result, calling error callback if exception is thrown.
Definition at line 226 of file error_handler.hpp.
|
inline |
Attach an error callback.
callback | Function to call if the future throws |
Definition at line 216 of file error_handler.hpp.
|
inlinenodiscard |
Check if the future is valid.
Definition at line 271 of file error_handler.hpp.
|
inline |
Wait for the future to complete.
Definition at line 245 of file error_handler.hpp.
|
inline |
Wait for the future with timeout.
Definition at line 254 of file error_handler.hpp.
|
inline |
Wait until a specific time point.
Definition at line 263 of file error_handler.hpp.