MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / select

Method select

tools/python-3.11.9-amd64/Lib/selectors.py:558–581  ·  view source on GitHub ↗
(self, timeout=None)

Source from the content-addressed store, hash-verified

556 return key
557
558 def select(self, timeout=None):
559 timeout = None if timeout is None else max(timeout, 0)
560 # If max_ev is 0, kqueue will ignore the timeout. For consistent
561 # behavior with the other selector classes, we prevent that here
562 # (using max). See https://bugs.python.org/issue29255
563 max_ev = self._max_events or 1
564 ready = []
565 try:
566 kev_list = self._selector.control(None, max_ev, timeout)
567 except InterruptedError:
568 return ready
569 for kev in kev_list:
570 fd = kev.ident
571 flag = kev.filter
572 events = 0
573 if flag == select.KQ_FILTER_READ:
574 events |= EVENT_READ
575 if flag == select.KQ_FILTER_WRITE:
576 events |= EVENT_WRITE
577
578 key = self._key_from_fd(fd)
579 if key:
580 ready.append((key, events & key.events))
581 return ready
582
583 def close(self):
584 self._selector.close()

Callers

nothing calls this directly

Calls 4

maxFunction · 0.85
_key_from_fdMethod · 0.80
controlMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected