[project @ 2001-10-31 10:30:29 by simonmar]
authorsimonmar <unknown>
Wed, 31 Oct 2001 10:30:29 +0000 (10:30 +0000)
committersimonmar <unknown>
Wed, 31 Oct 2001 10:30:29 +0000 (10:30 +0000)
Add setNonBlockingFd(), for use in the SIGCONT handler in Signals.c.

ghc/rts/RtsUtils.c
ghc/rts/RtsUtils.h

index a8ce114..0e302a7 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsUtils.c,v 1.22 2001/08/29 15:02:02 sewardj Exp $
+ * $Id: RtsUtils.c,v 1.23 2001/10/31 10:30:29 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -238,6 +238,18 @@ resetNonBlockingFd(int fd)
 #endif
 }
 
+void
+setNonBlockingFd(int fd)
+{
+  long fd_flags;
+
+#if !defined(mingw32_TARGET_OS)
+  /* clear the non-blocking flag on this file descriptor */
+  fd_flags = fcntl(fd, F_GETFL);
+  fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK);
+#endif
+}
+
 static ullong startTime = 0;
 
 /* used in a parallel setup */
index cb01e32..8825460 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: RtsUtils.h,v 1.11 2001/08/29 14:55:58 sewardj Exp $
+ * $Id: RtsUtils.h,v 1.12 2001/10/31 10:30:29 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -21,7 +21,8 @@ extern void _stgAssert (char *filename, unsigned int linenum);
 
 extern void heapOverflow(void);
 
-void resetNonBlockingFd(int fd);
+extern void setNonBlockingFd(int fd);
+extern void resetNonBlockingFd(int fd);
 
 extern nat stg_strlen(char *str);