SW Task Event Loop Framework v1.0.0
High-performance C++ asynchronous event loop framework with timer management and promise-based programming
Loading...
Searching...
No Matches
swt::CpuTaskTimeoutException Class Reference

Exception thrown when CPU-bound tasks exceed timeout limits. More...

#include <CpuTaskExecutor.h>

Inheritance diagram for swt::CpuTaskTimeoutException:
Inheritance graph
Collaboration diagram for swt::CpuTaskTimeoutException:
Collaboration graph

Public Member Functions

 CpuTaskTimeoutException (const std::string &message)
 Constructor with timeout message.
 

Detailed Description

Exception thrown when CPU-bound tasks exceed timeout limits.

This exception is thrown by CpuTaskExecutor when a CPU-intensive task doesn't complete within the specified timeout duration. Provides detailed timeout information for debugging and error handling.

The exception is generated by the timeout management system and delivered through the Promise mechanism to maintain thread safety and consistent error handling patterns.

promise.catch_error(looper, [](std::exception_ptr ex) {
try {
std::rethrow_exception(ex);
} catch (const CpuTaskTimeoutException& timeout) {
std::cerr << "Task timed out: " << timeout.what() << std::endl;
// Handle timeout-specific recovery
} catch (const std::exception& other) {
std::cerr << "Other error: " << other.what() << std::endl;
}
});
Exception thrown when CPU-bound tasks exceed timeout limits.
Note
Inherits from std::runtime_error for standard exception handling
Contains timeout duration information in error message
See also
CpuTaskExecutor::executeAsync, Promise::catch_error

Definition at line 55 of file CpuTaskExecutor.h.

Constructor & Destructor Documentation

◆ CpuTaskTimeoutException()

swt::CpuTaskTimeoutException::CpuTaskTimeoutException ( const std::string &  message)
inlineexplicit

Constructor with timeout message.

Parameters
messageDescriptive message including timeout duration

Creates a timeout exception with detailed information about the timeout duration and context for debugging purposes.

// Typical usage (internal to CpuTaskExecutor)
throw CpuTaskTimeoutException("CPU task timeout after 5000ms");

Definition at line 69 of file CpuTaskExecutor.h.


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