From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SbJ75-0004E4-F2 for garchives@archives.gentoo.org; Sun, 03 Jun 2012 22:17:31 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 528DEE094A; Sun, 3 Jun 2012 22:17:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 7562EE08DC for ; Sun, 3 Jun 2012 22:16:32 +0000 (UTC) Received: from [192.168.26.5] (ip98-164-193-252.oc.oc.cox.net [98.164.193.252]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id EF1751B4003 for ; Sun, 3 Jun 2012 22:16:31 +0000 (UTC) Message-ID: <4FCBE23E.9000208@gentoo.org> Date: Sun, 03 Jun 2012 15:16:30 -0700 From: Zac Medico User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:12.0) Gecko/20120506 Thunderbird/12.0.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] multiprocessing.eclass: doing parallel work in bash References: <201206011841.23302.vapier@gentoo.org> <201206030108.30493.vapier@gentoo.org> In-Reply-To: <201206030108.30493.vapier@gentoo.org> X-Enigmail-Version: 1.5pre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: cf5907a0-bfea-41fa-92d7-d8ebf6ded777 X-Archives-Hash: 8b7d284e308a69bbb42679675ab450ee -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/02/2012 10:08 PM, Mike Frysinger wrote: > # @FUNCTION: _multijob_fork # @INTERNAL # @DESCRIPTION: # Do the > actual book keeping. _multijob_fork() { [[ $# -eq 1 ]] || die > "incorrect number of arguments" > > local ret=0 [[ $1 == "pre" ]] && : $(( ++mj_num_jobs )) if [[ > ${mj_num_jobs} -ge ${mj_max_jobs} ]] ; then multijob_finish_one > ret=$? fi [[ $1 == "post" ]] && : $(( ++mj_num_jobs )) return > ${ret} } The "pre" logic seems wrong. Consider an initial state of mj_num_jobs=0 and mj_max_jobs=1. It will increment mj_num_jobs to 1, so [[ 1 -ge 1 ]] is true, and then call multijob_finish_one even though no jobs have started yet? Wouldn't that deadlock multijob_finish_one, as it waits for a reply from a job that doesn't exist yet? - -- Thanks, Zac -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/L4j4ACgkQ/ejvha5XGaPyuQCfSHRUHA1KoVc97yRZa8FlF+TS n04An1/c7IQaH4mqUtm8P305WKKDOgvE =EgJz -----END PGP SIGNATURE-----