[Commit] nickle file.c,1.46,1.47 io.c,1.9,1.10 value.h,1.81,1.82

commit@keithp.com commit@keithp.com
Tue, 22 Apr 2003 20:11:31 -0700


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv11440

Modified Files:
	file.c io.c value.h 
Log Message:
Delay exit until all buffered output is flushed


Index: file.c
===================================================================
RCS file: /local/src/CVS/nickle/file.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- file.c	22 Apr 2003 23:25:38 -0000	1.46
+++ file.c	23 Apr 2003 03:11:28 -0000	1.47
@@ -497,6 +497,8 @@
 FileFini (void)
 {
     MemCollect ();
+    while (anyFileWriteBlocked)
+	FileCheckBlocked (True);
 }
 
 static int
@@ -1611,12 +1613,12 @@
 }
 
 void
-FileCheckBlocked (void)
+FileCheckBlocked (Bool block)
 {
     ENTER ();
     fd_set	    readable, writable;
     int		    n, fd;
-    struct timeval  tv;
+    struct timeval  tv, *tvp;
     Value	    blocked, *prev;
     Bool	    ready;
     Bool	    writeBlocked;
@@ -1637,10 +1639,16 @@
 	if (fd >= n)
 	    n = fd + 1;
     }
-    tv.tv_usec = 0;
-    tv.tv_sec = 0;
+    if (block)
+	tvp = 0;
+    else
+    {
+	tv.tv_usec = 0;
+	tv.tv_sec = 0;
+	tvp = &tv;
+    }
     if (n > 0)
-	n = select (n, &readable, &writable, 0, &tv);
+	n = select (n, &readable, &writable, 0, tvp);
     if (n > 0)
     {
 	writeBlocked = False;

Index: io.c
===================================================================
RCS file: /local/src/CVS/nickle/io.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- io.c	17 Jul 2002 13:44:01 -0000	1.9
+++ io.c	23 Apr 2003 03:11:28 -0000	1.10
@@ -35,7 +35,7 @@
 void
 IoInterrupt (void)
 {
-    FileCheckBlocked ();
+    FileCheckBlocked (False);
 }
 
 void
@@ -105,7 +105,7 @@
 {
     if (anyTtyUnowned)
 	IoStart ();
-    FileCheckBlocked ();
+    FileCheckBlocked (False);
     if (anyFileWriteBlocked || anyFileReadBlocked || anyTtyUnowned)
 	return True;
     ioTimeoutQueued = False;

Index: value.h
===================================================================
RCS file: /local/src/CVS/nickle/value.h,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- value.h	17 Mar 2003 20:32:56 -0000	1.81
+++ value.h	23 Apr 2003 03:11:28 -0000	1.82
@@ -899,7 +899,7 @@
 void	FilePutArgType (Value f, ArgType *at);
 Value	FilePopen (char *program, char *args[], char *mode, int *errp);
 int	FileStatus (Value file);
-void	FileCheckBlocked (void);
+void	FileCheckBlocked (Bool block);
 void	FileSetBlocked (Value file, int flag);
 void	FilePrintf (Value, char *, ...);
 void	FileVPrintf (Value, char *, va_list);