author | Johannes Sixt <johannes.sixt@telecom.at> | |
Sat, 1 Dec 2007 21:00:56 +0000 (22:00 +0100) | ||
committer | Johannes Sixt <johannes.sixt@telecom.at> | |
Thu, 26 Jun 2008 06:45:07 +0000 (08:45 +0200) | ||
commit | 6ed807f8432c558ef102c94cb2e8ae4e03c48d4e | |
tree | 503421c25bc08c6691792fa6d8626b20f3d9a2c1 | tree | snapshot |
parent | ba26f296f9ddc694fc42683132bc328dffd777ec | commit | diff |
Windows: A rudimentary poll() emulation.
This emulation of poll() is by far not general. It assumes that the
fds that are to be waited for are connected to pipes. The pipes are
polled in a loop until data becomes available in at least one of them.
If only a single fd is waited for, the implementation actually does
not wait at all, but assumes that a subsequent read() will block.
In order not to needlessly burn CPU time, the CPU is yielded to other
processes before the next round in the poll loop using Sleep(0). Note that
any sleep timeout greater than zero will reduce the efficiency by a
magnitude.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This emulation of poll() is by far not general. It assumes that the
fds that are to be waited for are connected to pipes. The pipes are
polled in a loop until data becomes available in at least one of them.
If only a single fd is waited for, the implementation actually does
not wait at all, but assumes that a subsequent read() will block.
In order not to needlessly burn CPU time, the CPU is yielded to other
processes before the next round in the poll loop using Sleep(0). Note that
any sleep timeout greater than zero will reduce the efficiency by a
magnitude.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
compat/mingw.c | diff | blob | history |