50
50
.. versionadded:: 2.6
53
.. function:: kqueue(ident, filter=KQ_FILTER_READ, flags=KQ_ADD, fflags=0, data=0, udata=0)
53
.. function:: kevent(ident, filter=KQ_FILTER_READ, flags=KQ_ADD, fflags=0, data=0, udata=0)
55
55
(Only supported on BSD.) Returns a kernel event object object; see section
56
56
:ref:`kevent-objects` below for the methods supported by kqueue objects.
58
58
.. versionadded:: 2.6
61
.. function:: select(iwtd, owtd, ewtd[, timeout])
61
.. function:: select(rlist, wlist, xlist[, timeout])
63
63
This is a straightforward interface to the Unix :cfunc:`select` system call.
64
64
The first three arguments are sequences of 'waitable objects': either
65
65
integers representing file descriptors or objects with a parameterless method
66
named :meth:`fileno` returning such an integer. The three sequences of
67
waitable objects are for input, output and 'exceptional conditions',
68
respectively. Empty sequences are allowed, but acceptance of three empty
69
sequences is platform-dependent. (It is known to work on Unix but not on
70
Windows.) The optional *timeout* argument specifies a time-out as a floating
71
point number in seconds. When the *timeout* argument is omitted the function
72
blocks until at least one file descriptor is ready. A time-out value of zero
73
specifies a poll and never blocks.
66
named :meth:`fileno` returning such an integer:
68
* *rlist*: wait until ready for reading
69
* *wlist*: wait until ready for writing
70
* *xlist*: wait for an "exceptional condition" (see the manual page for what
71
your system considers such a condition)
73
Empty sequences are allowed, but acceptance of three empty sequences is
74
platform-dependent. (It is known to work on Unix but not on Windows.) The
75
optional *timeout* argument specifies a time-out as a floating point number
76
in seconds. When the *timeout* argument is omitted the function blocks until
77
at least one file descriptor is ready. A time-out value of zero specifies a
78
poll and never blocks.
75
80
The return value is a triple of lists of objects that are ready: subsets of the
76
81
first three arguments. When the time-out is reached without a file descriptor
91
96
.. index:: single: WinSock
93
File objects on Windows are not acceptable, but sockets are. On Windows, the
94
underlying :cfunc:`select` function is provided by the WinSock library, and does
95
not handle file descriptors that don't originate from WinSock.
98
File objects on Windows are not acceptable, but sockets are. On Windows,
99
the underlying :cfunc:`select` function is provided by the WinSock
100
library, and does not handle file descriptors that don't originate from
98
104
.. _epoll-objects:
266
272
Return the file descriptor number of the control fd.
269
.. method:: epoll.fromfd(fd)
275
.. method:: kqueue.fromfd(fd)
271
277
Create a kqueue object from a given file descriptor.
274
.. method:: control(changelist, max_events=0[, timeout=None]) -> eventlist
280
.. method:: kqueue.control(changelist, max_events[, timeout=None]) -> eventlist
276
282
Low level interface to kevent
338
344
+---------------------------+---------------------------------------------+
339
345
| :const:`KQ_EV_DISABLE` | Disablesevent |
340
346
+---------------------------+---------------------------------------------+
341
| :const:`KQ_EV_ONESHOT` | Removes event after first occurence |
347
| :const:`KQ_EV_ONESHOT` | Removes event after first occurrence |
342
348
+---------------------------+---------------------------------------------+
343
349
| :const:`KQ_EV_CLEAR` | Reset the state after an event is retrieved |
344
350
+---------------------------+---------------------------------------------+
373
379
+============================+============================================+
374
380
| :const:`KQ_NOTE_DELETE` | *unlink()* was called |
375
381
+----------------------------+--------------------------------------------+
376
| :const:`KQ_NOTE_WRITE` | a write occured |
382
| :const:`KQ_NOTE_WRITE` | a write occurred |
377
383
+----------------------------+--------------------------------------------+
378
384
| :const:`KQ_NOTE_EXTEND` | the file was extended |
379
385
+----------------------------+--------------------------------------------+