eve.core.posix.loop
Shared POSIX utilities for Layer 1 event loop implementations.
This module provides common POSIX types, signal handling utilities, and helper functions used by both Linux and BSD/macOS event loop backends. Platform-specific implementations (loop_linux.d, loop_kqueue.d) import this module for shared functionality.
struct EventLoopConfig
Types 1
structEventLoopConfig
Configuration for EventLoop.create.
Fields
size_t watcherCapacityNumber of watcher slots preallocated at loop creation.size_t eventCapacityNumber of native events buffered per backend poll operation.size_t dnsCapacityNumber of asynchronous DNS resolution slots preallocated.EventLoopLimits limitsResource limits configuration.bool delegate(LimitKind kind, size_t current, size_t limit) @safe nothrow onLimitApproachingCalled when a limit is about to be hit (if `LimitAction.callback` is set).void delegate(LimitKind kind) @safe nothrow onLimitExceededCalled when a limit is exceeded and the action is `reject`.Functions 15
fn
size_t normalizedWatcherCapacity(size_t requested) pure @safe nothrow @nogcNormalize a requested watcher capacity to a minimum sane value.fn
size_t normalizedDnsCapacity(size_t requested) pure @safe nothrow @nogcNormalize a requested DNS capacity to a minimum sane value.fn
size_t normalizedEventCapacity(size_t requested) pure @safe nothrow @nogcNormalize a requested event capacity to a minimum sane value.fn
uint nextGeneration(uint generation) pure @safe nothrow @nogcAdvance a generation counter, skipping zero.fn
ulong packToken(Token token) pure @safe nothrow @nogcPack a watcher token into a 64-bit user data value.fn
Token unpackToken(ulong userData) pure @safe nothrow @nogcUnpack a 64-bit user data value into a watcher token.fn
int signalNumber(Signal signal) pure @safe nothrow @nogcMap a normalized signal to its POSIX signal number.fn
sigset_t signalMask(Signal signal) @trusted nothrowCreate a signal mask containing a single signal.fn
int blockSignalMask(sigset_t mask, sigset_t * savedMask = null) @trusted nothrowBlock a signal mask and optionally save the previous mask.fn
int restoreSignalMask(ref const(sigset_t) savedMask) @trusted nothrowRestore a previously saved signal mask.fn
void closePipe(ref int[2] fds) @trusted nothrowClose a pipe pair, handling already-closed descriptors.fn
int setNonBlocking(Handle handle) @trusted nothrow @nogcSet a file descriptor to non-blocking mode.Templates 4
tmplIoWatcherCallbackOf(EventLoop)
Callback signature template for I/O watchers.
Platform implementations should define:
alias IoWatcherCallback = void delegate(ref EventLoop loop, Token token, IoReady ready) @safe nothrow;tmplWatcherCallbackOf(EventLoop)
Callback signature template for timer, phase, and wakeup watchers.
Platform implementations should define:
alias WatcherCallback = void delegate(ref EventLoop loop, Token token) @safe nothrow;tmplSignalWatcherCallbackOf(EventLoop)
Callback signature template for signal watchers.
Platform implementations should define:
alias SignalWatcherCallback = void delegate(ref EventLoop loop, Token token, SignalInfo info) @safe nothrow;tmplDnsWatcherCallbackOf(EventLoop)
Callback signature template for DNS resolution.
Platform implementations should define:
alias DnsWatcherCallback = void delegate(ref EventLoop loop, Token token, scope const(IpAddress)[] addrs, DnsError error) @safe nothrow;