|
Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
|
#include <stdatomic.h>#include "serene/rt/context.h"#include "serene/rt/fiber/thread.h"#include "serene/rt/impl/pqmh.h"#include "serene/rt/impl/spsc_ring.h"#include "serene/rt/reactor.h"Go to the source code of this file.
Data Structures | |
| struct | srn_reactor_io_channel_t |
| A channel, the per-worker submission and completion ring pair. More... | |
| struct | srn_reactor_t |
Typedefs | |
| typedef struct srn_reactor_io_channel_t | srn_reactor_io_channel_t |
| A channel, the per-worker submission and completion ring pair. | |
Functions | |
| void | srn_reactor_post_completion (srn_reactor_t *reactor, size_t channel, srn_reactor_io_completion_t completion) |
| Post a finished operation to channel's completion queue and rouse the channel's worker through the notify mechanism. | |
| srn_error_t * | srn_reactor_errors_static (srn_error_tag_t tag) |
| Return the shared, immutable error for an IO failure tag. | |
| typedef struct srn_reactor_io_channel_t srn_reactor_io_channel_t |
A channel, the per-worker submission and completion ring pair.
| srn_error_t * srn_reactor_errors_static | ( | srn_error_tag_t | tag | ) |
Return the shared, immutable error for an IO failure tag.
These live in static storage, not a context, so a completion or result can point one at maybe_error with no allocation and no lifetime concern, and it is safe to share across threads. A backend maps its native code (via srn_errno_to_tag on POSIX) to a tag, then to one of these. Any tag without a dedicated entry yields the UNKNOWN_IO_ERROR error.
Definition at line 125 of file reactor.c.
| void srn_reactor_post_completion | ( | srn_reactor_t * | reactor, |
| size_t | channel, | ||
| srn_reactor_io_completion_t | completion ) |
Post a finished operation to channel's completion queue and rouse the channel's worker through the notify mechanism.
Runs on the reactor thread, called by the core for ops it completes itself (such as NOP) and by a backend when a descriptor operation finishes. It does NOT drop the in-flight count: that is the consumer's job via srn_reactor_op_done, so an op counts as gone only once the waiting fiber has been readied, never in the gap between.
Definition at line 141 of file reactor.c.