InterlockedExchangePointer() guarantees that store operation is done with
memory barrier and reading of variable is done immediately after
declaration. So volatile is not needed at all.
---
 mingw-w64-crt/misc/_localtime64.c | 2 +-
 mingw-w64-crt/misc/_mktime64.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/misc/_localtime64.c 
b/mingw-w64-crt/misc/_localtime64.c
index b49ce209563e..c3abd3f45fc6 100644
--- a/mingw-w64-crt/misc/_localtime64.c
+++ b/mingw-w64-crt/misc/_localtime64.c
@@ -25,7 +25,7 @@ static struct tm *__cdecl emu__localtime64(const __time64_t 
*timeptr)
      * thread-safe call, the race condition is not a problem.
      */
     {
-        static volatile long tzset_called = 0;
+        static long tzset_called = 0;
         if (!tzset_called) {
             _tzset();
             (void)InterlockedExchange(&tzset_called, 1);
diff --git a/mingw-w64-crt/misc/_mktime64.c b/mingw-w64-crt/misc/_mktime64.c
index 924e6635446d..f7854caaad2e 100644
--- a/mingw-w64-crt/misc/_mktime64.c
+++ b/mingw-w64-crt/misc/_mktime64.c
@@ -25,7 +25,7 @@ static __time64_t __cdecl emu__mktime64(struct tm *tmptr)
      * thread-safe call, the race condition is not a problem.
      */
     {
-        static volatile long tzset_called = 0;
+        static long tzset_called = 0;
         if (!tzset_called) {
             _tzset();
             (void)InterlockedExchange(&tzset_called, 1);
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to