Starts a wake-up operation, allowing threads to execute callbacks on loop thread. More...
#include <Async.h>
Public Types | |
using | CompletionData = AsyncCompletionData |
Completion data for AsyncLoopWakeUp. More... | |
using | Result = AsyncResultOf< AsyncLoopWakeUp, CompletionData > |
Callback result for AsyncLoopWakeUp. More... | |
Public Types inherited from SC::AsyncRequest | |
enum class | Type : uint8_t { LoopTimeout , LoopWakeUp , LoopWork , ProcessExit , SocketAccept , SocketConnect , SocketSend , SocketReceive , SocketClose , FileRead , FileWrite , FileClose , FilePoll } |
Type of async request. More... | |
Public Member Functions | |
SC::Result | start (AsyncEventLoop &eventLoop, EventObject *eventObject=nullptr) |
Starts a wake up request, that will be fulfilled when an external thread calls AsyncLoopWakeUp::wakeUp. More... | |
SC::Result | wakeUp () |
Wakes up event loop, scheduling AsyncLoopWakeUp::callback on next AsyncEventLoop::run (or its variations) More... | |
Public Member Functions inherited from SC::AsyncRequest | |
void | setDebugName (const char *newDebugName) |
AsyncEventLoop * | getEventLoop () const |
Get the event loop associated with this AsyncRequest. More... | |
void | cacheInternalEventLoop (AsyncEventLoop &loop) |
Caches the event loop associated with this AsyncRequest. More... | |
AsyncRequest (Type type) | |
Constructs a free async request of given type. More... | |
Result | stop () |
Stops the async operation. More... | |
bool | isFree () const |
Public Attributes | |
Function< void(Result &)> | callback |
Callback called by SC::AsyncEventLoop::run after SC::AsyncLoopWakeUp::wakeUp. More... | |
Public Attributes inherited from SC::AsyncRequest | |
AsyncRequest * | next = nullptr |
AsyncRequest * | prev = nullptr |
Friends | |
struct | AsyncEventLoop |
Additional Inherited Members | |
Protected Member Functions inherited from SC::AsyncRequest | |
Result | validateAsync () |
Result | queueSubmission (AsyncEventLoop &eventLoop) |
Result | queueSubmission (AsyncEventLoop &eventLoop, ThreadPool &threadPool, AsyncTask &task) |
Protected Attributes inherited from SC::AsyncRequest | |
AsyncEventLoop * | eventLoop = nullptr |
AsyncTask * | asyncTask = nullptr |
Starts a wake-up operation, allowing threads to execute callbacks on loop thread.
SC::AsyncLoopWakeUp::callback will be invoked on the thread running SC::AsyncEventLoop::run (or its variations) after SC::AsyncLoopWakeUp::wakeUp has been called.
An EventObject can be wait-ed to synchronize further actions from the thread invoking the wake up request, ensuring that the callback has finished its execution.
Completion data for AsyncLoopWakeUp.
Callback result for AsyncLoopWakeUp.
SC::Result SC::AsyncLoopWakeUp::start | ( | AsyncEventLoop & | eventLoop, |
EventObject * | eventObject = nullptr |
||
) |
Starts a wake up request, that will be fulfilled when an external thread calls AsyncLoopWakeUp::wakeUp.
eventLoop | The event loop where queuing this async request |
eventObject | Optional EventObject to synchronize external threads waiting until the callback is finished. |
SC::Result SC::AsyncLoopWakeUp::wakeUp | ( | ) |
Wakes up event loop, scheduling AsyncLoopWakeUp::callback on next AsyncEventLoop::run (or its variations)
Callback called by SC::AsyncEventLoop::run after SC::AsyncLoopWakeUp::wakeUp.