diff -Naur py3k/Modules/_multiprocessing//socket_connection.c py3k_new/Modules/_multiprocessing//socket_connection.c --- py3k/Modules/_multiprocessing//socket_connection.c 2010-05-09 17:52:27.000000000 +0200 +++ py3k_new/Modules/_multiprocessing//socket_connection.c 2010-11-25 12:11:34.412378003 +0100 @@ -6,6 +6,9 @@ * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt */ +#ifndef MS_WINDOWS +#include +#endif #include "multiprocessing.h" #ifdef MS_WINDOWS @@ -148,6 +151,7 @@ } } +#ifdef MS_WINDOWS /* * Check whether any data is available for reading -- neg timeout blocks */ @@ -191,6 +195,33 @@ return FALSE; } } +#else +/* + * Check whether any data is available for reading -- neg timeout blocks + */ + +static int +conn_poll(ConnectionObject *conn, double timeout, PyThreadState *_save) +{ + int res; + struct pollfd p; + + p.fd = (int)conn->handle; + p.events = POLLIN | POLLPRI; + p.revents = 0; + + res = poll(&p, 1, (int)timeout * 1000); + + if (res < 0) { + return MP_SOCKET_ERROR; + } else if (p.revents & (POLLIN | POLLPRI)) { + return TRUE; + } else { + assert(res == 0); + return FALSE; + } +} +#endif /* * "connection.h" defines the Connection type using defs above