From ab2876ab120cac5e59819035eefc1798777f43e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Thu, 1 Jan 2015 15:15:03 +0100 Subject: fixed yet another data race warning (nw) --- src/osd/sdl/sdlwork.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/osd/sdl/sdlwork.c') diff --git a/src/osd/sdl/sdlwork.c b/src/osd/sdl/sdlwork.c index d5f42d91033..216858af36e 100644 --- a/src/osd/sdl/sdlwork.c +++ b/src/osd/sdl/sdlwork.c @@ -690,14 +690,20 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa begin_timing(thread->runtime); // loop until everything is processed - while (queue->list != NULL) + while (true) { osd_work_item *item; - INT32 lockslot; // use a critical section to synchronize the removal of items - lockslot = osd_scalable_lock_acquire(queue->lock); + INT32 lockslot = osd_scalable_lock_acquire(queue->lock); { + if (queue->list == NULL) + { + osd_scalable_lock_release(queue->lock, lockslot); + break; + } + + // pull the item from the queue item = (osd_work_item *)queue->list; if (item != NULL) -- cgit v1.2.3