Windows: Fix race between windows_clock_gettime_threaded() and windows_clock_gettime()
commit69d88b7fef75aef4ab99b1086c5be84626aedceb
authorSimon Haggett <simon.haggett@realvnc.com>
Fri, 12 Jul 2013 09:06:00 +0000 (12 10:06 +0100)
committerPete Batard <pete@akeo.ie>
Wed, 7 Aug 2013 23:43:57 +0000 (8 00:43 +0100)
tree5eb161029cd92f756c196a7912f2a7906ab111cf
parentb3562727e9cb75bf503c476452c9378c79385e71
Windows: Fix race between windows_clock_gettime_threaded() and windows_clock_gettime()

* When the timer thread is created in windows_init(), it performs an
  initialisation phase in which it uses QueryPerformanceFrequency() to determine
  if there is a high resolution timer available, and sets hires_frequency and
  hires_ticks_to_ps appropriately. However, since windows_init() does not wait for
  this initialisation phase to complete, windows_clock_gettime() can be called
  before hires_frequency and hires_ticks_to_ps have been updated. This can result
  in windows_clock_gettime() temporarily returning real-time clock values even
  though the platform supports a monotonic clock.
* See http://sourceforge.net/mailarchive/forum.php?thread_name=1373620013-3574-1-git-send-email-simon.haggett%40realvnc.com&forum_name=libusbx-devel
libusb/os/windows_usb.c
libusb/version_nano.h