fixed yet another data race warning (nw)

This commit is contained in:
Oliver Stöneberg 2015-01-01 15:15:03 +01:00
parent 0c0260ec2d
commit ab2876ab12
2 changed files with 18 additions and 6 deletions

View File

@ -690,14 +690,20 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa
begin_timing(thread->runtime); begin_timing(thread->runtime);
// loop until everything is processed // loop until everything is processed
while (queue->list != NULL) while (true)
{ {
osd_work_item *item; osd_work_item *item;
INT32 lockslot;
// use a critical section to synchronize the removal of items // 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 // pull the item from the queue
item = (osd_work_item *)queue->list; item = (osd_work_item *)queue->list;
if (item != NULL) if (item != NULL)

View File

@ -681,14 +681,20 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa
begin_timing(thread->runtime); begin_timing(thread->runtime);
// loop until everything is processed // loop until everything is processed
while (queue->list != NULL) while (true)
{ {
osd_work_item *item; osd_work_item *item;
INT32 lockslot;
// use a critical section to synchronize the removal of items // 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 // pull the item from the queue
item = (osd_work_item *)queue->list; item = (osd_work_item *)queue->list;
if (item != NULL) if (item != NULL)