server: Restart at the head of the wait queue when we woke a thread, since this can modify the queue.

This commit is contained in:
Alexandre Julliard 2009-06-13 12:20:49 +02:00
parent 3fe51326cd
commit fd78e6e3a5
1 changed files with 6 additions and 6 deletions

View File

@ -712,15 +712,15 @@ done:
/* attempt to wake threads sleeping on the object wait queue */
void wake_up( struct object *obj, int max )
{
struct list *ptr, *next;
struct list *ptr;
LIST_FOR_EACH_SAFE( ptr, next, &obj->wait_queue )
LIST_FOR_EACH( ptr, &obj->wait_queue )
{
struct wait_queue_entry *entry = LIST_ENTRY( ptr, struct wait_queue_entry, entry );
if (wake_thread( entry->thread ))
{
if (max && !--max) break;
}
if (!wake_thread( entry->thread )) continue;
if (max && !--max) break;
/* restart at the head of the list since a wake up can change the object wait queue */
ptr = &obj->wait_queue;
}
}