delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/11/26/13:07:59

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:message-id:from:reply-to:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=nD2PXh
XJKXyIYEaqlRGmQu+B+W1ZfrHiWaZj7ILekEImVCag38NkzI65begS46X2ZgJZ+8
iqp4tqgwjRq0u/oYv2ubF/+5ryjMmRv9oSymCkoQWJ18xUJGtrb327akEXXgA3pL
I2dBjnEK4ULEni5VHDZStFgNLYSPQnLXECYHM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:message-id:from:reply-to:to:subject
:references:in-reply-to:content-type; s=default; bh=GWXsz6Epmeav
EP/FlNelNYOBcvo=; b=E6g1JkL4zvjBJhIvc7BpstEjXYOcza+1TGH3nE/qwALr
xYLm0WprSHK5F2hxv79G7QBJXJ1dFdduZVcYNXbqyhHKni4t8KE+AYPedSTfObTo
Q8yhB664I4UzWXRnGsQqap2i1/ZyE3bE5OEI8J9qEB2EkQ+KN6E5K1DgjzOcTvg=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=seven, Seven, 11000, UD:X
X-HELO: lb3-smtp-cloud7.xs4all.net
Date: Mon, 26 Nov 2018 19:07:44 +0100
Message-ID: <093958e15892f03eecfe6eea1ce6566f@smtp-cloud7.xs4all.net>
From: Houder <houder AT xs4all DOT nl>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: No thread safety in clock_gettime (hires_ns::prime)
References: <CAOWZHxdJi1E9APtSXm35LkDU33VqGZSwnGtvOfdHA9PTTJgRjQ AT mail DOT gmail DOT com> <20181126170140 DOT GO30649 AT calimero DOT vinschen DOT de>
In-Reply-to: <20181126170140.GO30649@calimero.vinschen.de>
User-Agent: mua.awk 0.99

On Mon, 26 Nov 2018 18:01:40, Corinna Vinschen  wrote:
> 
> On Nov 23 11:27, James E. King III wrote:
[snip]

> > I found that a call to
> > clock_gettime(CLOCK_MONOTONIC, ..) has a one-time initialization that
> > is not thread-safe.  If two threads call this at the same time, they
> > will race.  The results I am seeing are typically that one of the two
> > callers get a timespec structure with zero values, and no error return
> > code from the call.
> 
> Thanks for the testcase, but I can't reproduce the problem, neither on
> 32 bit nor on 64 bit.  I tweaked your makefile to have a 100K loop I
> started multiple times with differently optimzed code, but to no avail.
> 
> To account for that, I inspected the code doing the initialization and
> found that it uses REALTIME priority when trying to make sure multiple
> threads don't collide.  This is a bit on the dangerous side, apparently.
> 
> I tweaked the code to use a spinlock instead.
> 
> I'm just about to upload new developer snapshots to
> https://cygwin.com/snapshots/
> 
> Should be up in 10 mins or so.  Can you please try if this fixes the
> problem for you?

 - only replaced the cygwin1.dll ...

Henri

64-@@ uname -a
CYGWIN_NT-6.1 Seven 2.11.3(0.329/5/3)  x86_64 Cygwin
64-@@ ls -l /bin/cygwin1*
-rwxr-xr-x 1 Henri None 3339661 Nov  8 14:36 /bin/cygwin1-2.11.2.X
-rwxr-xr-x 1 Henri None 3337995 Nov 26 18:43 /bin/cygwin1-64-20181126.X
-rwxr-xr-x 1 Henri None 3337995 Nov 26 18:43 /bin/cygwin1.dll
64-@@ cd threads
64-@@ make test
64-@@ make test
64-@@ make test
64-@@ make test
64-@@ make test
64-@@ make test
64-@@ make test
64-@@ make test
64-@@ vi Makefile
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ #... wait a while ...
64-@@ for loop in {1..100}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..1000}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..1000}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..1000}; do ./cyg_hires_clock_race.exe; done
64-@@ for loop in {1..10000}; do ./cyg_hires_clock_race.exe; done
64-@@# That is enough!

=====


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019