mirror of
https://github.com/3proxy/3proxy.git
synced 2026-10-28 22:05:48 +08:00
src/loop.c, not used yet: one thread waiting for many sockets and timers, calling back what waits for them, for clients to be served by a thread each serves many of. Sockets are waited for with epoll on Linux, kqueue on the BSDs and macOS, poll() (WSAPoll() on Windows) elsewhere or with LOOP_POLL, level-triggered; one with nothing to wait for is taken from the system, or an error or a hang up would be reported all the same. One deleted while the sockets ready are being called is not called. Timers wait in a wheel of 1024 one-second slots. One due within a turn waits at the head of the slot of its second, all there due in the same second; one due later behind them, in the order of their seconds, or, if due before the last there, at the head of the last slot of the turn, looked at again then. Moving a timer later costs nothing while it waits in the wheel: it is looked at when its old deadline comes and moved then. When its slot comes a timer due within the second waits in a heap, so it fires to the millisecond, as does one set within the second. The clock is monotonic. Another thread posts to the loop, waking it with an eventfd, a pipe, or on Windows a UDP socket sending to itself. tests/looptest.c tests it on its own, timers on a clock of its own through several turns of the wheel: built by CMake, run by the loop case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| admin.py | ||
| auto.py | ||
| counters.py | ||
| dnspr.py | ||
| httpsrv_auth.py | ||
| httpsrv_files.py | ||
| httpsrv_keepalive.py | ||
| httpsrv_ops.py | ||
| httpsrv_parsing.py | ||
| httpsrv_proxypass.py | ||
| httpsrv_rules.py | ||
| ipv6.py | ||
| ktls.py | ||
| logs.py | ||
| loop.py | ||
| maxconn.py | ||
| parent_failover.py | ||
| parent_ports.py | ||
| parent_weights.py | ||
| pcre.py | ||
| portmap.py | ||
| proxy_headers.py | ||
| proxy_http.py | ||
| reattach.py | ||
| reload.py | ||
| socks.py | ||
| splice.py | ||
| ssl.py | ||
| sysdns.py | ||
| takeover.py | ||
| timeouts.py | ||
| tlspr.py | ||
| transparent.py | ||
| udploop.py | ||
| unixsock.py | ||