From 94512ecc124fb5bf78db1c355b9fb5674090bc19 Mon Sep 17 00:00:00 2001 From: Jinoh Kang Date: Sun, 18 Sep 2022 23:31:19 +0900 Subject: [PATCH] concrt140: Use atomic write for releasing threadsafe_queue spin lock. This fixes data race in ARM/ARM64 platforms, and prevents potential memory access reordering by the compiler. --- dlls/concrt140/details.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/concrt140/details.c b/dlls/concrt140/details.c index be5bc4a81d4..978a7a8f96e 100644 --- a/dlls/concrt140/details.c +++ b/dlls/concrt140/details.c @@ -225,7 +225,7 @@ static void threadsafe_queue_push(threadsafe_queue *queue, size_t id, queue->tail = p; if(!queue->head) queue->head = p; - queue->lock = 0; + WriteRelease(&queue->lock, 0); } else { @@ -275,7 +275,7 @@ static BOOL threadsafe_queue_pop(threadsafe_queue *queue, size_t id, queue->head = p->_Next; if(!queue->head) queue->tail = NULL; - queue->lock = 0; + WriteRelease(&queue->lock, 0); /* TODO: Add exception handling */ call__Concurrent_queue_base_v4__Deallocate_page(parent, p);