1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
On 06/02/2012 10:08 PM, Mike Frysinger wrote: |
5 |
> # @FUNCTION: _multijob_fork # @INTERNAL # @DESCRIPTION: # Do the |
6 |
> actual book keeping. _multijob_fork() { [[ $# -eq 1 ]] || die |
7 |
> "incorrect number of arguments" |
8 |
> |
9 |
> local ret=0 [[ $1 == "pre" ]] && : $(( ++mj_num_jobs )) if [[ |
10 |
> ${mj_num_jobs} -ge ${mj_max_jobs} ]] ; then multijob_finish_one |
11 |
> ret=$? fi [[ $1 == "post" ]] && : $(( ++mj_num_jobs )) return |
12 |
> ${ret} } |
13 |
|
14 |
The "pre" logic seems wrong. Consider an initial state of |
15 |
mj_num_jobs=0 and mj_max_jobs=1. It will increment mj_num_jobs to 1, |
16 |
so [[ 1 -ge 1 ]] is true, and then call multijob_finish_one even |
17 |
though no jobs have started yet? Wouldn't that deadlock |
18 |
multijob_finish_one, as it waits for a reply from a job that doesn't |
19 |
exist yet? |
20 |
- -- |
21 |
Thanks, |
22 |
Zac |
23 |
-----BEGIN PGP SIGNATURE----- |
24 |
Version: GnuPG v2.0.19 (GNU/Linux) |
25 |
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ |
26 |
|
27 |
iEYEARECAAYFAk/L4j4ACgkQ/ejvha5XGaPyuQCfSHRUHA1KoVc97yRZa8FlF+TS |
28 |
n04An1/c7IQaH4mqUtm8P305WKKDOgvE |
29 |
=EgJz |
30 |
-----END PGP SIGNATURE----- |