From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Fixes: f768d6b31bebc35fbaf751d0cd57c8bd302a8d60 --- libs/fluidsynth/glib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/fluidsynth/glib.c b/libs/fluidsynth/glib.c index cd938a4fb6b..2450924eb78 100644 --- a/libs/fluidsynth/glib.c +++ b/libs/fluidsynth/glib.c @@ -40,10 +40,14 @@ int g_snprintf( char *buffer, size_t size, const char *format, ... ) double g_get_monotonic_time(void) { - static LARGE_INTEGER frequency = {0}; - LARGE_INTEGER counter; + static volatile LONG64 freq_cache; + LARGE_INTEGER counter, frequency; - if (!frequency.QuadPart) QueryPerformanceFrequency( &frequency ); + if (!(frequency.QuadPart = ReadAcquire64( &freq_cache ))) + { + QueryPerformanceFrequency( &frequency ); + WriteRelease64( &freq_cache, frequency.QuadPart ); + } QueryPerformanceCounter( &counter ); return counter.QuadPart * 1000000.0 / frequency.QuadPart; /* time in micros */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9023