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
As of version 0.006, the backend contract described here is considered stable. New optional methods may be added in future releases, but required methods and callback ABI will not change.
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.
SEE ALSO
Linux::Event::Loop, Linux::Event::Backend::Epoll
SYNOPSIS
# Internal. See L<Linux::Event::Loop>.
VERSION
This document describes Linux::Event::Backend version 0.006.
AUTHOR
Joshua S. Day
LICENSE
Same terms as Perl itself.