summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Oliver Stöneberg <oliverst@online.de>2015-01-01 15:15:03 +0100
committer Oliver Stöneberg <oliverst@online.de>2015-01-01 15:15:03 +0100
commitab2876ab120cac5e59819035eefc1798777f43e5 (patch)
tree15a7736822512bde18ec84ce43daf9466c5b77eb /src
parent0c0260ec2de1cd9cff7f436d99a598e9a8f99ad8 (diff)
fixed yet another data race warning (nw)
Diffstat (limited to 'src')
-rw-r--r--src/osd/sdl/sdlwork.c12
-rw-r--r--src/osd/windows/winwork.c12
2 files changed, 18 insertions, 6 deletions
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)
diff --git a/src/osd/windows/winwork.c b/src/osd/windows/winwork.c
index 97162fdaa23..c987cca7c33 100644
--- a/src/osd/windows/winwork.c
+++ b/src/osd/windows/winwork.c
@@ -681,14 +681,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)