summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/hi-q.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/tools/hi-q.c b/tools/hi-q.c
index 2078c60..b2a4c7c 100644
--- a/tools/hi-q.c
+++ b/tools/hi-q.c
@@ -272,22 +272,18 @@ int main(int argc, char** argv, char const * const * env) {
cerr << "*** kid " << ii << " setpgid OK" << endl;
}
- if (ii==0) {
- int junk;
- cerr << "about to read sync" << endl;
- ssize_t rslt = read(sync[rEnd], &junk, 1);
- if (rslt != 1) {
- cerr << "bad sync ... 1 != " << rslt << endl;
- } else {
- cerr << "back from read sync, good: " << rslt << endl;
- }
+ if (ii == 0) {
+ int junk(1);
+ write(sync[wEnd], &junk, 1);
+ cerr << "sync sent" << endl;
}
-
#if 1
cerr << "kid [" << ii << "] " << getpid()
- << " kidpid[0] " << kidpid[0]
+ << " kidpid[0]: " << kidpid[0]
+ << " pgid: " << getpgid(0)
<< " starts" << endl;
#endif
+ usleep(50000);
// Now that we are through creating pipes, we don't
// need to continue blocking fd1:
close(1);
@@ -327,6 +323,19 @@ int main(int argc, char** argv, char const * const * env) {
panic(ex_syserr);
}
close(kid_end);
+
+ if (ii==0) {
+ int junk;
+ cerr << "about to read sync" << endl;
+ ssize_t rslt = read(sync[rEnd], &junk, 1);
+ if (rslt != 1) {
+ cerr << "bad sync ... 1 != " << rslt << endl;
+ } else {
+ cerr << "back from read sync, good: " << rslt << endl;
+ }
+ }
+
+
// it is important to let kid#0 run a while;
// otherwise it won't fully exist when the other kids start,
// and depending race conditions, the setpgid could fail
@@ -340,12 +349,6 @@ int main(int argc, char** argv, char const * const * env) {
#endif
} /* end loop starting all kids */
- { // release the hold on kid #0
- int junk(1);
- write(sync[wEnd], &junk, 1);
- cerr << "sync sent" << endl;
- }
-
// here with the whole pipeline of kids launched
close(0); // the reading end of stdin was