X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA5CE383F19C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1699902501; bh=al8TSVy8c1p3BJk2v2m2Ie/QVow3iJo/oVMLnFwm37A=; 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=g4wFZo+3q7rzphN092mGGJVsGQvNRsBHUsNsceE32th6FXYNIqAW69dtMF2aTdhC8 QLbn2Zg2OVLakf7yR1RFohoBv2XjYis4Y8i3LDLgX21BgVRqOMnCQ9Df9oEY2pL3vw bQyucswP8uFnLu4uPH525zkUtPOK+fhtRA3v18K0= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0FAC2385841E Date: Mon, 13 Nov 2023 20:07:44 +0100 To: Bruno Haible Subject: Re: random is not multithread-safe in Cygwin Message-ID: Mail-Followup-To: Bruno Haible , cygwin AT cygwin DOT com References: <3811044 DOT 57xzQst1vy AT nimes> <10013068 DOT gMo3ACIZaO AT nimes> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <10013068.gMo3ACIZaO@nimes> 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 , cygwin AT cygwin DOT com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Nov 13 19:04, Bruno Haible via Cygwin wrote: > Corinna Vinschen wrote: > > > And indeed glibc, musl libc, AIX, Android, and even NetBSD implement it in a > > > multithread-safe way. > > > > Our code is from FreeBSD, originally. I checked the latest code from > > FreeBSD. It doesn't lock anything in random() and generates the same > > error when running the same test app. > > > > Why is that ok for FreeBSD? > > It is not OK in FreeBSD, either. This is what I noted in the Gnulib manual: > https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/posix-functions/random.texi > > But it is MT-safe in NetBSD (in the '#ifndef SMALL_RANDOM' branch): > http://cvsweb.netbsd.org/bsdweb.cgi/src/common/lib/libc/stdlib/random.c?rev=1.7&content-type=text/x-cvsweb-markup Ok, I pushed a patch(*) to make the random(3) functions thread-safe, more or less following NetBSDs lead. If you get a chance, give the next test release cygwin-3.5.0-0.459.gd223f095905a a try. The patch will be part of the next release, 3.4.10. Thanks, Corinna (*) https://sourceware.org/git/?p=newlib-cygwin.git;a=commit;h=06e463223b95 -- 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