X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSelect.c;h=223bdd6551a7f4f2a90b4bc902c5dcc7389a8a9b;hb=51d5aa5a6dae21bd2e6995f0f196fdde39088921;hp=73aad1a2a6c5d6e14e071e35f194c8b6043ed1dc;hpb=384d5bcf83b6e7ee103fca364ca1ab6ef831834a;p=ghc-hetmet.git diff --git a/ghc/rts/Select.c b/ghc/rts/Select.c index 73aad1a..223bdd6 100644 --- a/ghc/rts/Select.c +++ b/ghc/rts/Select.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Select.c,v 1.26 2003/02/22 06:13:41 sof Exp $ + * $Id: Select.c,v 1.32 2004/07/15 20:50:40 sof Exp $ * * (c) The GHC Team 1995-2002 * @@ -12,9 +12,6 @@ /* #include "PosixSource.h" */ #include "Rts.h" -#ifndef mingw32_TARGET_OS -/* to the end */ - #include "Schedule.h" #include "RtsUtils.h" #include "RtsFlags.h" @@ -34,6 +31,10 @@ #include #include +#ifdef HAVE_UNISTD_H +#include +#endif + /* last timestamp */ nat timestamp = 0; @@ -235,12 +236,14 @@ awaitEvent(rtsBool wait) * we could block for a long time before the signal is * serviced. */ +#if defined(RTS_USER_SIGNALS) if (signals_pending()) { RELEASE_LOCK(&sched_mutex); /* ToDo: kill */ startSignalHandlers(); ACQUIRE_LOCK(&sched_mutex); return; /* still hold the lock */ } +#endif /* we were interrupted, return to the scheduler immediately. */ @@ -348,6 +351,20 @@ wakeBlockedWorkerThread() workerWakeupPending = rtsTrue; } } -#endif -#endif /* !mingw_TARGET_OS */ +/* resetWorkerWakeupPipeAfterFork + * + * To be called right after a fork(). + * After the fork(), the worker wakeup pipe will be shared + * with the parent process, and that's something we don't want. + */ +void +resetWorkerWakeupPipeAfterFork() +{ + if(workerWakeupInited) { + close(workerWakeupPipe[0]); + close(workerWakeupPipe[1]); + } + workerWakeupInited = rtsFalse; +} +#endif