[Commit] nickle execute.c, 1.84, 1.85 file.c, 1.53, 1.54 nickle.h,
1.109, 1.110 value.h, 1.93, 1.94
Keith Packard
commit at keithp.com
Sun Oct 12 23:08:44 PDT 2003
- Previous message: [Commit] nickle/builtin file.c,1.12,1.13
- Next message: [Commit] nickle file.5c, NONE, 1.1 Makefile.am, 1.36,
1.37 builtin.5c, 1.3, 1.4 printf.5c, 1.6, 1.7 scanf.5c, 1.16, 1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv2378
Modified Files:
execute.c file.c nickle.h value.h
Log Message:
Use SIGCHLD to trigger wait
Index: execute.c
===================================================================
RCS file: /local/src/CVS/nickle/execute.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- execute.c 24 Jul 2003 18:10:19 -0000 1.84
+++ execute.c 13 Oct 2003 05:08:41 -0000 1.85
@@ -911,6 +911,11 @@
signalIo = False;
IoInterrupt ();
}
+ if (signalChild)
+ {
+ signalChild = False;
+ ProcessInterrupt ();
+ }
if (lex && !(lex->file.flags & (FileInputBlocked|FileOutputBlocked)))
break;
}
Index: file.c
===================================================================
RCS file: /local/src/CVS/nickle/file.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- file.c 13 Oct 2003 04:33:36 -0000 1.53
+++ file.c 13 Oct 2003 05:08:41 -0000 1.54
@@ -452,10 +452,33 @@
return 1;
}
+volatile Bool signalChild;
+
+static RETSIGTYPE
+sigchld (int sig)
+{
+ resetSignal (SIGCHLD, sigchld);
+ SetSignalChild ();
+}
+
+void
+ProcessInterrupt ()
+{
+ for (;;) {
+ pid_t pid;
+ int status;
+
+ pid = wait3 (&status, WNOHANG, NULL);
+ if (pid < 0 && errno == ECHILD)
+ break;
+ }
+}
+
int
FileInit (void)
{
ENTER ();
+ catchSignal (SIGCHLD, sigchld);
fileBlockedReference = NewReference ((void **) &fileBlocked);
MemAddRoot (fileBlockedReference);
FileInitErrors ();
@@ -1117,12 +1140,6 @@
close (file->file.fd);
file->file.fd = -1;
}
- /* FIXME -- dont block waiting for child */
- if (file->file.pid != 0)
- {
- while (waitpid (file->file.pid, &file->file.status, 0) < 0);
- file->file.pid = 0;
- }
}
EXIT ();
return n;
Index: nickle.h
===================================================================
RCS file: /local/src/CVS/nickle/nickle.h,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- nickle.h 13 Oct 2003 04:33:36 -0000 1.109
+++ nickle.h 13 Oct 2003 05:08:41 -0000 1.110
@@ -666,6 +666,7 @@
void IoInterrupt (void);
void FileFini (void);
+void ProcessInterrupt (void);
void *AllocateTemp (int size);
Index: value.h
===================================================================
RCS file: /local/src/CVS/nickle/value.h,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- value.h 13 Oct 2003 04:33:36 -0000 1.93
+++ value.h 13 Oct 2003 05:08:41 -0000 1.94
@@ -1086,11 +1086,13 @@
extern volatile Bool signalTimer; /* timer interrupt */
extern volatile Bool signalIo; /* i/o interrupt */
extern volatile Bool signalProfile; /* vtimer interrupt */
+extern volatile Bool signalChild; /* sub process interrupt */
#define SetSignalInterrupt()(aborting = signaling = signalInterrupt = True)
#define SetSignalTimer() (signaling = signalTimer = True)
#define SetSignalIo() (signaling = signalIo = True)
#define SetSignalProfile() (signaling = signalProfile = True)
+#define SetSignalChild() (signaling = signalChild = True)
/*
* Any signal state set by regular code doesn't need to be volatile
- Previous message: [Commit] nickle/builtin file.c,1.12,1.13
- Next message: [Commit] nickle file.5c, NONE, 1.1 Makefile.am, 1.36,
1.37 builtin.5c, 1.3, 1.4 printf.5c, 1.6, 1.7 scanf.5c, 1.16, 1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list