NAME

Fetch::Loop::Standalone - Fetch's own vendored C event loop

SYNOPSIS

my $loop = Fetch::Loop::Standalone->new;   # best backend for the platform
$loop->timer(0.1, sub { print "tick\n" });
$loop->run_until($future);

DESCRIPTION

The default event loop used when no framework loop (Hyperman, IO::Async, AnyEvent) is active. It wraps a pluggable readiness backend (kqueue on macOS/BSD, epoll on Linux, io_uring when available, poll everywhere) behind watch_io/unwatch_io/timer, and pumps with run/run_until/stop.

new([$backend])

Create a loop; pass a backend name (kqueue/epoll/poll/iouring) to force one, otherwise the best available is chosen.

watch_io($fh, $mode, $cb) / unwatch_io($fh, $mode)

Register/remove a persistent readiness callback; $mode contains r and/or w. $fh is a filehandle or a bare fd number.

timer($secs, $cb)

Run $cb once after $secs.

run / run_until($future) / stop

Pump the loop until stop, or until $future resolves.

backend

The name of the readiness backend in use.

install_await

Install $Fetch::Future::AWAIT so a bare $future->get pumps this loop.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION. This is free software, licensed under the Artistic License 2.0.