Starts an handle polling operation. More...
#include <Async.h>
Public Types | |
using | CompletionData = AsyncCompletionData |
using | Result = AsyncResultOf<AsyncFilePoll, CompletionData> |
![]() | |
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 &loop, FileDescriptor::Handle fileDescriptor) |
Starts a file descriptor poll operation, monitoring its readiness with appropriate OS API. | |
![]() | |
void | setDebugName (const char *newDebugName) |
AsyncEventLoop * | getEventLoop () const |
Get the event loop associated with this AsyncRequest. | |
void | cacheInternalEventLoop (AsyncEventLoop &loop) |
Caches the event loop associated with this AsyncRequest. | |
Result | setThreadPoolAndTask (ThreadPool &pool, AsyncTask &task) |
Sets the thread pool and task to use for this request. | |
void | resetThreadPoolAndTask () |
Resets anything previously set with setThreadPoolAndTask. | |
AsyncRequest (Type type) | |
Constructs a free async request of given type. | |
Result | stop (Function< void(AsyncResult &)> *afterStopped=nullptr) |
Ask to stop current async operation. | |
bool | isFree () const |
Returns true if this request is free. | |
bool | isCancelling () const |
Returns true if this request is being cancelled. | |
bool | isActive () const |
Returns true if this request is active or being reactivated. | |
Type | getType () const |
Returns request type. | |
Result | start (AsyncEventLoop &loop) |
Shortcut for AsyncEventLoop::start. | |
Public Attributes | |
Function< void(Result &)> | callback |
![]() | |
AsyncRequest * | next = nullptr |
AsyncRequest * | prev = nullptr |
Friends | |
struct | AsyncEventLoop |
Additional Inherited Members | |
![]() | |
Result | checkState () |
void | queueSubmission (AsyncEventLoop &eventLoop) |
![]() | |
AsyncEventLoop * | eventLoop = nullptr |
AsyncTask * | asyncTask = nullptr |
Starts an handle polling operation.
Uses GetOverlappedResult
(windows), kevent
(macOS), epoll
(Linux) and io_uring
(Linux). Callback will be called when any of the three API signals readiness events on the given file descriptor. Check File System Watcher for an example usage of this notification.
SC::Result SC::AsyncFilePoll::start | ( | AsyncEventLoop & | loop, |
FileDescriptor::Handle | fileDescriptor ) |
Starts a file descriptor poll operation, monitoring its readiness with appropriate OS API.