COROIO: NNet::TVoidTask Struct Reference
COROIO
 
Loading...
Searching...
No Matches
NNet::TVoidTask Struct Reference

Fire-and-forget coroutine handle. More...

#include <promises.hpp>

Inheritance diagram for NNet::TVoidTask:

Public Types

using promise_type = TVoidPromise
 

Detailed Description

Fire-and-forget coroutine handle.

Cannot be co_await-ed. Self-destructs on completion (final_suspend → suspend_never). Unhandled exceptions are silently swallowed.

Use for detached tasks that outlive their caller — e.g. per-connection handlers spawned inside an accept loop.

TVoidTask handle_client(TSocket sock) {
char buf[4096]; ssize_t n;
while ((n = co_await sock.ReadSome(buf, sizeof(buf))) > 0)
co_await sock.WriteSome(buf, n);
}
auto WriteSome(const void *buf, size_t size)
Asynchronously writes data from the provided buffer to the socket.
Definition socket.hpp:189
auto ReadSome(void *buf, size_t size)
Asynchronously reads data from the socket into the provided buffer.
Definition socket.hpp:139
High-level asynchronous socket for network communication.
Definition socket.hpp:367
Fire-and-forget coroutine handle.
Definition promises.hpp:26

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