[project @ 2004-04-05 10:53:52 by simonpj]
[ghc-hetmet.git] / ghc / rts / Select.c
index 70e0a03..d7e6ffc 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Select.c,v 1.28 2003/04/01 15:05:22 sof Exp $
+ * $Id: Select.c,v 1.30 2003/10/01 10:49:09 wolfgang Exp $
  *
  * (c) The GHC Team 1995-2002
  *
 #include <errno.h>
 #include <string.h>
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 /* last timestamp */
 nat timestamp = 0;
 
@@ -347,4 +351,20 @@ wakeBlockedWorkerThread()
        workerWakeupPending = rtsTrue;
     }
 }
+
+/* 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