1: # include <stdio.h>
2:
3: # include "../ingres.h"
4: # include "../aux.h"
5: # include "monitor.h"
6:
7: /*
8: ** WAIT FOR PROCESS TO DIE
9: **
10: ** Used in edit() and shell() to terminate the subprocess.
11: ** Waits on pid "Xwaitpid". If this is zero, xwait() returns
12: ** immediately.
13: **
14: ** This is called by "catchsig()" so as to properly terminate
15: ** on a rubout while in one of the subsystems.
16: **
17: ** Uses trace flag 15
18: */
19:
20: xwait()
21: {
22: int status;
23: register int i;
24: register char c;
25:
26: # ifdef xMTR2
27: if (tTf(15, 0))
28: printf("xwait: [%d]\n", Xwaitpid);
29: # endif
30: if (Xwaitpid == 0)
31: {
32: cgprompt();
33: return;
34: }
35: while ((i = wait(&status)) != -1)
36: {
37: # ifdef xMTR2
38: if (tTf(15, 1))
39: printf("pid %d stat %d\n", i, status);
40: # endif
41: if (i == Xwaitpid)
42: break;
43: }
44:
45: Xwaitpid = 0;
46:
47: /* reopen query buffer */
48: if ((Qryiop = fopen(Qbname, "a")) == NULL)
49: syserr("xwait: open %s", Qbname);
50: Notnull = 1;
51:
52: cgprompt();
53: }
Defined functions
xwait
defined in line
20; used 3 times