summaryrefslogtreecommitdiff
path: root/tools/hi-q.c
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-15 00:43:51 -0700
committerJohn Denker <jsd@av8n.com>2012-07-15 00:43:51 -0700
commit4b48aa187bd7917842ec651dbd0322396b363c2f (patch)
treec7c9baf12baa38717e7aa6441b672bde259f9b67 /tools/hi-q.c
parentfb6042c5cd8a411cfcfcf6c1a1d466eb42a4ff33 (diff)
annoying race condition, works sometimes but not reliable
Diffstat (limited to 'tools/hi-q.c')
-rw-r--r--tools/hi-q.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/hi-q.c b/tools/hi-q.c
index 14ca5ec..1e71ef4 100644
--- a/tools/hi-q.c
+++ b/tools/hi-q.c
@@ -217,7 +217,7 @@ int main(int argc, char** argv, char const * const * env) {
// doesn't choose it. That allows N-1 of the kids
// to close it and dup() something useful onto it.
- for (unsigned int ii=0; ii < nkids; ii++){ /* loop over all kids */
+ for (unsigned int ii=0; ii < nkids; ii++){ /* loop starting all kids */
int datapipe[2];
int kid_end;
@@ -307,13 +307,14 @@ int main(int argc, char** argv, char const * const * env) {
// 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
- if (1) usleep(0);
+////////??? if (1) usleep(0);
+ if (ii == 0) usleep(1);
#if 1
cerr << "forked kid #" << ii
<< " (" << kidpid[ii] << ") "
<< endl;
#endif
- }
+ } /* end loop starting all kids */
// here with the whole pipeline of kids running