WaitableAsyncSocketIoRequest class
A socket request a task can wait on until the operation completes.
- Use
import ThinkMeta.ConcurrentTasks.AsyncIo.AsyncSocketIoRequest;- Namespace
ThinkMeta::ConcurrentTasks::AsyncIo- Platforms
- Windows, Linux
Syntax
using WaitableAsyncSocketIoRequest =
_WaitableAsyncSocketIoRequest<AsyncSocketIoRequest, SuspensionKind::Multiple>;
using WaitableAsyncSocketIoRequest_s =
_WaitableAsyncSocketIoRequest<AsyncSocketIoRequest, SuspensionKind::Single>;
using WaitableAsyncSocketRecvIoRequest =
_WaitableAsyncSocketIoRequest<
AsyncSocketRecvIoRequest,
SuspensionKind::Multiple
>;
using WaitableAsyncSocketRecvIoRequest_s =
_WaitableAsyncSocketIoRequest<AsyncSocketRecvIoRequest, SuspensionKind::Single>;Template parameters
_AsyncSocketIoRequestAsyncSocketIoRequestType- The request built on:
AsyncSocketIoRequest, orAsyncSocketRecvIoRequestto also capture the result flags of a receive. _SuspensionKindSuspensionKindSuspensionKind::Multiple: any number of tasks may wait;SuspensionKind::Single: at most one waiting task, cheaper, allows a timeout.
Remarks
A manual-reset event is set when the operation completes. Use the WaitableAsyncSocketIoRequest, WaitableAsyncSocketIoRequest_s, WaitableAsyncSocketRecvIoRequest and WaitableAsyncSocketRecvIoRequest_s variants below. The Single variant allows one waiting task and timed waits; once its Wait returns, nothing in the library touches the object again, so it may live on the waiting task's stack and be destroyed right away. The Multiple variant allows any number of waiting tasks but no timeout.
Names
| Name | Description |
|---|---|
WaitableAsyncSocketIoRequest |
Waitable socket request, any number of waiting tasks (Multiple), no timed wait. |
WaitableAsyncSocketIoRequest_s |
Waitable socket request, at most one waiting task (Single); cheaper, allows timed waits. |
WaitableAsyncSocketRecvIoRequest |
Waitable receive request, any number of waiting tasks (Multiple).
Captures the result flags (see |
WaitableAsyncSocketRecvIoRequest_s |
Waitable receive request, at most one waiting task (Single); allows timed waits.
Captures the result flags (see |
Constructors
WaitableAsyncSocketIoRequest
Windows only
Creates an idle receive request.
Syntax
explicit WaitableAsyncSocketIoRequest(SOCKET socket) noexcept;Parameters
socketSOCKET- The socket the operation runs on; used to query the result flags.
Methods
RequestCompleted
Records the result, then sets the event.
Syntax
void RequestCompleted(
AsyncIoRequestBase::CompletionError error,
AsyncIoRequestBase::ByteCount bytesTransferred
) noexcept override;Parameters
errorAsyncIoRequestBase::CompletionError- The operation's own error code;
0on success. bytesTransferredAsyncIoRequestBase::ByteCount- Bytes the operation transferred.
Remarks
Setting the event is the last access on behalf of the completion.
Reset
Re-arms the request for another operation.
Syntax
void Reset() noexcept override;Remarks
Only after the previous operation has completed.
TryWait
true if the operation has completed; never blocks.
Syntax
bool TryWait() noexcept;Return value
Type: bool
true if the operation has completed; false while it is still in flight.
See also
Wait
Suspends the calling task until the operation has completed.
Syntax
void Wait() noexcept;Remarks
Task only.
See also
_s only
Waits for the completion with a timeout.
Syntax
[[nodiscard]] WaitStatus Wait(Duration timeout) noexcept;Parameters
timeoutDuration- How long to wait at most.
Return value
Type: WaitStatus
WaitStatus::Signaled if the operation has completed; WaitStatus::TimedOut if the timeout expired first; WaitStatus::Cancelled if the waiting task was cancelled (CancelTask).
Remarks
Single waiter only. Task only; needs EnableTimers for a finite timeout (without it the wait has no limit). A timeout or cancel does not cancel the operation: the request must stay alive until it has completed.
See also
Generated from ThinkMeta.ConcurrentTasks.API @ c7663c4 (2026-11-19).