From 953acc0a696690db43048c09ee0ff73ce2403e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Wed, 31 Dec 2014 10:50:59 +0100 Subject: [PATCH] fixed another ThreadSanitizer data race warning (nw) --- src/osd/sdl/sdlwork.c | 6 +++--- src/osd/windows/winwork.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/osd/sdl/sdlwork.c b/src/osd/sdl/sdlwork.c index 349b6ead38c..b4cca4d5078 100644 --- a/src/osd/sdl/sdlwork.c +++ b/src/osd/sdl/sdlwork.c @@ -97,7 +97,7 @@ struct osd_work_queue volatile INT32 items; // items in the queue volatile INT32 livethreads; // number of live threads volatile INT32 waiting; // is someone waiting on the queue to complete? - volatile UINT8 exiting; // should the threads exit on their next opportunity? + volatile INT32 exiting; // should the threads exit on their next opportunity? UINT32 threads; // number of threads in this queue UINT32 flags; // creation flags work_thread_info * thread; // array of thread information @@ -313,7 +313,7 @@ void osd_work_queue_free(osd_work_queue *queue) end_timing(queue->thread[queue->threads].waittime); // signal all the threads to exit - queue->exiting = TRUE; + atomic_exchange32(&queue->exiting, TRUE); for (threadnum = 0; threadnum < queue->threads; threadnum++) { work_thread_info *thread = &queue->thread[threadnum]; @@ -504,7 +504,7 @@ int osd_work_item_wait(osd_work_item *item, osd_ticks_t timeout) if (item->event == NULL) item->event = osd_event_alloc(TRUE, FALSE); // manual reset, not signalled else - osd_event_reset(item->event); + osd_event_reset(item->event); // if we don't have an event, we need to spin (shouldn't ever really happen) if (item->event == NULL) diff --git a/src/osd/windows/winwork.c b/src/osd/windows/winwork.c index 0d28da4ed98..2cc9ecec698 100644 --- a/src/osd/windows/winwork.c +++ b/src/osd/windows/winwork.c @@ -109,7 +109,7 @@ struct osd_work_queue volatile INT32 items; // items in the queue volatile INT32 livethreads; // number of live threads volatile INT32 waiting; // is someone waiting on the queue to complete? - volatile UINT8 exiting; // should the threads exit on their next opportunity? + volatile INT32 exiting; // should the threads exit on their next opportunity? UINT32 threads; // number of threads in this queue UINT32 flags; // creation flags work_thread_info * thread; // array of thread information @@ -323,7 +323,7 @@ void osd_work_queue_free(osd_work_queue *queue) end_timing(queue->thread[queue->threads].waittime); // signal all the threads to exit - queue->exiting = TRUE; + atomic_exchange32(&queue->exiting, TRUE); for (threadnum = 0; threadnum < queue->threads; threadnum++) { work_thread_info *thread = &queue->thread[threadnum];