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

Method select

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

Source from the content-addressed store, hash-verified

400 return key
401
402 def select(self, timeout=None):
403 # This is shared between poll() and epoll().
404 # epoll() has a different signature and handling of timeout parameter.
405 if timeout is None:
406 timeout = None
407 elif timeout <= 0:
408 timeout = 0
409 else:
410 # poll() has a resolution of 1 millisecond, round away from
411 # zero to wait *at least* timeout seconds.
412 timeout = math.ceil(timeout * 1e3)
413 ready = []
414 try:
415 fd_event_list = self._selector.poll(timeout)
416 except InterruptedError:
417 return ready
418 for fd, event in fd_event_list:
419 events = 0
420 if event & ~self._EVENT_READ:
421 events |= EVENT_WRITE
422 if event & ~self._EVENT_WRITE:
423 events |= EVENT_READ
424
425 key = self._key_from_fd(fd)
426 if key:
427 ready.append((key, events & key.events))
428 return ready
429
430
431if hasattr(select, 'poll'):

Callers

nothing calls this directly

Calls 3

_key_from_fdMethod · 0.80
pollMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected