summaryrefslogtreecommitdiff
path: root/tools/hi-q.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-15 02:20:47 -0700
committerJohn Denker <jsd@av8n.com>2012-07-15 02:20:47 -0700
commitc7bfbf600424d10d7c464dc84a25611470da5d1f (patch)
treeac4541edb3af4ca15fb60c1a8601c4bc250c8227 /tools/hi-q.c
parent1c2fd04a23b88f1f2361653caf90bfe86ca5e81c (diff)
seems to work
Diffstat (limited to 'tools/hi-q.c')
-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