From ceb7488a7762a74422fb1a616e21750087977a03 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sat, 21 Jan 2006 16:19:47 +0000 Subject: [PATCH] poll() and select() are still not cancellation points in MacOS X 10.4.4... --- BasiliskII/src/Unix/ether_unix.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/BasiliskII/src/Unix/ether_unix.cpp b/BasiliskII/src/Unix/ether_unix.cpp index d5b32501..8c95c8a5 100644 --- a/BasiliskII/src/Unix/ether_unix.cpp +++ b/BasiliskII/src/Unix/ether_unix.cpp @@ -20,6 +20,19 @@ #include "sysdeps.h" +/* + * NOTES concerning MacOS X issues: + * - poll() does not exist in 10.2.8, but is available in 10.4.4 + * - select(), and very likely poll(), are not cancellation points. So + * the ethernet thread doesn't stop on exit. An explicit check is + * performed to workaround this problem. + */ +#if (defined __APPLE__ && defined __MACH__) || ! defined HAVE_POLL +#define USE_POLL 0 +#else +#define USE_POLL 1 +#endif + #ifdef HAVE_SYS_POLL_H #include #endif @@ -815,7 +828,7 @@ static void *receive_func(void *arg) for (;;) { // Wait for packets to arrive -#if HAVE_POLL +#if USE_POLL struct pollfd pf = {fd, POLLIN, 0}; int res = poll(&pf, 1, -1); #else