diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hi-q.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/tools/hi-q.c b/tools/hi-q.c index 3de9f1c..2078c60 100644 --- a/tools/hi-q.c +++ b/tools/hi-q.c @@ -265,13 +265,22 @@ int main(int argc, char** argv, char const * const * env) { // equal to pid of kid#0 if (ii) kidgroup = kidpid[0]; if (setpgid(0, kidgroup) != 0) { - cerr << "setpgid failed! " << errno << " ... "; + cerr << "*** kid " << ii + << " setpgid failed! " << errno << " ... "; perror(0); + } else { + cerr << "*** kid " << ii << " setpgid OK" << endl; } - if (ii == 0) { - int junk(1); - write(sync[wEnd], &junk, 1); - //cerr << "sync sent" << 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 1 @@ -324,14 +333,6 @@ int main(int argc, char** argv, char const * const * env) { ////////??? if (1) usleep(0); ///////??? if (ii == 0) usleep(1); - if (ii==0) { - int junk; - //cerr << "about to read sync" << endl; - ssize_t rslt = read(sync[rEnd], &junk, 1); - //cerr << "back from read sync: " << rslt << endl; - if (rslt) {} - } - #if 0 cerr << "apparent kid #" << ii << " (" << kidpid[ii] << ") " @@ -339,6 +340,12 @@ 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 |