NAME
Linux::Event::Backend - Backend contract for Linux::Event::Loop
DESCRIPTION
This module documents the minimal backend interface expected by Linux::Event::Loop. Backends are intentionally duck-typed.
The loop owns scheduling policy (clock/timer/scheduler). The backend owns the wait/dispatch mechanism (epoll now, io_uring later).
STATUS
EXPERIMENTAL / WORK IN PROGRESS
The API is not yet considered stable and may change without notice.
REQUIRED METHODS
new(%args)
Create the backend instance.
watch($fh, $mask, $cb, %opt) -> $fd
Register a filehandle for readiness notifications.
Callback signature (standardized by this project):
$cb->($loop, $fh, $fd, $mask, $tag);
Where:
$loopis the Linux::Event::Loop instance$fhis the watched filehandle$fdis the integer file descriptor$maskis an integer readiness mask (backend-defined bit layout, standardized within this project)$tagis an arbitrary user value (optional; may be undef)
Backends may accept additional options in %opt. This distribution uses:
_loop- the loop reference to pass through to the callbacktag- the tag value to pass through to the callback
unwatch($fh_or_fd) -> $bool
Remove a watcher by filehandle or file descriptor.
run_once($loop, $timeout_s=undef) -> $n
Block until events occur (or timeout) and dispatch them.
Return value is backend-defined; for now callers should not rely on it.
OPTIONAL METHODS
modify($fh_or_fd, $mask, %opt) -> $bool
Update an existing watcher registration (e.g. add/remove interest in writable). If not implemented, the loop may fall back to unwatch+watch.