diff options
author | John Denker <jsd@av8n.com> | 2012-07-15 00:43:51 -0700 |
---|---|---|
committer | John Denker <jsd@av8n.com> | 2012-07-15 00:43:51 -0700 |
commit | 4b48aa187bd7917842ec651dbd0322396b363c2f (patch) | |
tree | c7c9baf12baa38717e7aa6441b672bde259f9b67 /tools | |
parent | fb6042c5cd8a411cfcfcf6c1a1d466eb42a4ff33 (diff) |
annoying race condition, works sometimes but not reliable
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hi-q.c | 7 | ||||
-rw-r--r-- | tools/hi-test.c | 2 | ||||
-rw-r--r-- | tools/hi-test.conf | 6 |
3 files changed, 8 insertions, 7 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 diff --git a/tools/hi-test.c b/tools/hi-test.c index 3befedd..01e475b 100644 --- a/tools/hi-test.c +++ b/tools/hi-test.c @@ -3,5 +3,5 @@ using namespace std; int main(){ - cerr << getpid() << " : " << getpgid(0) << endl; + cerr << "++++ " << getpid() << " : " << getpgid(0) << endl; } diff --git a/tools/hi-test.conf b/tools/hi-test.conf index d09ba81..6c697c2 100644 --- a/tools/hi-test.conf +++ b/tools/hi-test.conf @@ -1,3 +1,3 @@ -hi-test -hi-test -hi-test +hi-test x0 +hi-test x1 +hi-test x2 |