void *Workqueue_GetWork(tWorkqueue *Queue)
{
- tThread *us;
-
for( ;; )
{
// Check for work
return ret;
}
- // Go to sleep
- SHORTLOCK(&glThreadListLock);
- us = Threads_RemActive();
- us->WaitPointer = Queue;
- us->Status = THREAD_STAT_QUEUESLEEP;
- Queue->Sleeper = us;
- SHORTREL(&Queue->Protector);
- SHORTREL(&glThreadListLock);
-
- // Yield and sleep
- Threads_int_WaitForStatusEnd(THREAD_STAT_QUEUESLEEP);
-
- us->WaitPointer = NULL;
+ Threads_int_Sleep(THREAD_STAT_QUEUESLEEP,
+ Queue, 0,
+ &Queue->Sleeper, NULL, &Queue->Protector);
}
}