DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 56HFKFll1068434 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 56HFKFll1068434 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=u/Wohg3k X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D59C63856082 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1752765612; bh=ag8UiDtN4aV1oJ8AvAcKZSkBDS8d68rFWQlKlctQbXk=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=u/Wohg3kfGo6CBLI0Wwjm6/BiC9NkN0iD3oqwhpCkrLrpafztcEFEDNHsCQvOtXQM 5qvq8yMgAEg5V4ATAfZ2lsao7oMf+/SMSa01fTnwXDSXbSynwGW8ceObkmgvK6nqxW 8dIjraUf+8uZhpVpIFBrQpjizDdpSuCkSpj3kpy8= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 742E63858C53 Date: Thu, 17 Jul 2025 17:19:49 +0200 To: cygwin AT cygwin DOT com Subject: Re: Calling system() in multi-threads. Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: <20250617215411 DOT ebf69d1c18b55191a1b76c01 AT nifty DOT ne DOT jp> <20250618203127 DOT 71ac180de11230a9a6055185 AT nifty DOT ne DOT jp> <20250716235236 DOT 96055ec145d9a0528b50c357 AT nifty DOT ne DOT jp> <20250717231421 DOT 56b54f7e96266311101d4c08 AT nifty DOT ne DOT jp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250717231421.56b54f7e96266311101d4c08@nifty.ne.jp> X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 56HFKFll1068434 On Jul 17 23:14, Takashi Yano via Cygwin wrote: > Hi Corinna, > > On Wed, 16 Jul 2025 17:36:42 +0200 > Corinna Vinschen wrote: > > On Jul 16 23:52, Takashi Yano via Cygwin wrote: > > > Do you have any idea? > > > > Locking would be super-simple. > > > > But theoretically it should be possible to use a local child_info_spawn > > variable at this point. The ch_spawn child_info_spawn instance is not > > copied to the child anyway, so that should be safe. The same goes for > > posix_spawn() then, btw. > > > > I checked the sources and I don't see any dependency to ch_spawn > > from a spawning process, in contrast to an exec'ing process. That > > doesn't mean there is none, just that I didn't find any. > > Thanks! > As a starting point, I tried tntroducing locking. It almost works > as expected, however, sometimes my STC in my first report is hangs > if N is large e.g. 100. The patch is as attached. > > What am I missing? I don't know. You're perhaps not releasing the lock in all cases. But I would have to debug this just like you ¯\_(ツ)_/¯ Out of curiosity, did you try using a locale child_info_spawn instance instead? That would be a rather nice solution, but I'm pretty sure there's some other problem lurking in the dark... Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple