Class CCallbackThread

Class Documentation

class CCallbackThread

A class that encapsulates threaded functionality with a callback interface.

Public Functions

inline CCallbackThread(std::function<void()> callback)

Constructor for the CallbackThread class.

Parameters:

callback – A callback function to be executed in the CallbackThread thread.

inline ~CCallbackThread()
CCallbackThread(const CCallbackThread&) = delete
CCallbackThread &operator=(const CCallbackThread&) = delete
CCallbackThread(CCallbackThread &&rhs) = delete
CCallbackThread &operator=(CCallbackThread &&rhs) = delete
template<typename DurationType>
inline void start(DurationType timeout)

Start the callback thread with a specified timeout.

Parameters:

timeout – The timeout duration for waiting in the callback thread.

inline void stop()

Stop the callback thread. Waits for the callback thread to finish its work.

inline void trigger()

Trigger the callback thread to interrupt the current sleep without stopping it. The callback function will be executed immediately.