No thread safety in clock_gettime (hires_ns::prime)

Houder houder@xs4all.nl
Tue Nov 27 10:19:00 GMT 2018


On Tue, 27 Nov 2018 10:37:38, Corinna Vinschen  wrote:
> 
> On Nov 26 19:07, Houder wrote:
[snip]

> > 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
[snip]

> > 64-@@ for loop in {1..10000}; do ./cyg_hires_clock_race.exe; done
> > 64-@@# That is enough!
> 
> Thanks a lot for testing!  (Particulary since I couldn't even
> reproduce this on W7)

Perhaps my machine is a bit "peculiar" ... :-)
(the real litmus test is, of course, James E. King III's application, not the STC)

Henri

/home/corinna/src/cygwin/cygwin-2.11.2/cygwin-2.11.2-1.i686/src/newlib-cygwin/winsup/cygwin/cygheap.cc
64-@@ uname -a
CYGWIN_NT-6.1 Seven 2.11.2(0.329/5/3) 2018-08-31 13:05 x86_64 Cygwin

64-@@ cd threads
64-@@ for loop in {1..1000}; do ./cyg_hires_clock_race.exe; done
ERROR: one of the timespec structures was zero:
main thread: tv_sec =       3455 tv_nsec =  350898985
 2nd thread: tv_sec =          0 tv_nsec =          0
64-@@ for loop in {1..1000}; do ./cyg_hires_clock_race.exe; done
ERROR: one of the timespec structures was zero:
main thread: tv_sec =       3461 tv_nsec =  157276019
 2nd thread: tv_sec =          0 tv_nsec =          0
ERROR: one of the timespec structures was zero:
main thread: tv_sec =       3467 tv_nsec =  493831379
 2nd thread: tv_sec =          0 tv_nsec =          0
ERROR: one of the timespec structures was zero:
main thread: tv_sec =       3467 tv_nsec =  855769393
 2nd thread: tv_sec =          0 tv_nsec =          0

Perhaps the following is significant?

64-@@ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
stepping        : 3
cpu MHz         : 3398.000
cache size      : 8192 KB
...

processor       : 7
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
stepping        : 3
cpu MHz         : 3398.000
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 4
apicid          : 7
initial apicid  : 7
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca \
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni dtes64 \
monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm sse4_1 sse4_2 \
x2apic movbe popcnt aes xsave osxsave avx f16c rdrand lahf_lm ida arat \
epb xsaveopt pln pts dtherm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

=====


--
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



More information about the Cygwin mailing list