File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ # libev select backend notes
2+
3+ ## Build composition
4+ - ` libev_la_SOURCES ` only lists ` ev.c ` and ` event.c ` because ` ev.c ` directly
5+ ` #include ` s the backend implementations such as ` ev_select.c ` . This means the
6+ select backend is compiled whenever ` ev.c ` is built, without needing to list
7+ the backend sources separately.
8+
9+ ## Signal handling and readiness notification
10+ - When a signal arrives, ` ev_sighandler() ` invokes ` ev_feed_signal() ` , which
11+ records the pending signal and calls ` evpipe_write() ` to wake the loop via the
12+ self-pipe using the async-signal-safe ` write() ` system call.
13+ - The select backend copies the tracked fd sets before calling ` select() ` .
14+ If ` select() ` returns with ` EINTR ` , the backend simply returns to the main
15+ loop. Because the self-pipe write occurred before the interruption completes,
16+ the pipe remains readable and will be observed on the next poll iteration,
17+ ensuring the readiness notification is delivered.
18+ - ` select_poll() ` also detects ` EBADF ` and ` ENOMEM ` , reporting them via
19+ libev’s error helpers, and it retries interrupted ` read() ` /` write() ` calls to
20+ drain or signal the pipe, so the loop cannot miss the wakeup due to transient
21+ EINTR interruptions.
You can’t perform that action at this time.
0 commit comments