Appendix-File-Descriptor
Appendix-File-Descriptor
In the context of selectors, fileobj is used only for monitoring I/O readiness events.
Selectors are built around OS-level file descriptors, and file descriptors represent resources that support non-blocking I/O, such as:
- sockets
- pipes
- files
- character devices
- eventfd / timerfd (on Linux)
- custom objects exposing a
.fileno()that maps to one of the above
Selectors do not care about anything else — only whether a file descriptor is ready for reading or writing.
What selectors do
A selector monitors file descriptors for events:
EVENT_READ→ "ready to read without blocking"EVENT_WRITE→ "ready to write without blocking"
✔ What selectors do NOT do
Selectors do not:
- read or write data
- watch arbitrary objects
- handle application logic
- manage timeouts or threading by themselves
They exist purely to efficiently check I/O readiness in event loops.