From 8c82e30fe5b7547a48de70cb2b111f621c985941 Mon Sep 17 00:00:00 2001 From: Misha Koshelev Date: Wed, 31 Jan 2007 08:44:34 -0600 Subject: wineserver: Make sure while we are waking a thread we do not try to do it again. --- server/thread.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/server/thread.c b/server/thread.c index b4a16cd..b477364 100644 --- a/server/thread.c +++ b/server/thread.c @@ -58,6 +58,8 @@ struct thread_wait struct thread *thread; /* owner thread */ int count; /* count of objects */ int flags; + int waking; /* whether we are currently waking this + * thread */ void *cookie; /* magic cookie to return to client */ struct timeval timeout; struct timeout_user *user; @@ -447,6 +449,7 @@ static void end_wait( struct thread *thr int i; assert( wait ); + thread->wait->waking = 1; for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) entry->obj->ops->remove_queue( entry->obj, entry ); if (wait->user) remove_timeout_user( wait->user ); @@ -467,6 +470,7 @@ static int wait_on( int count, struct ob wait->count = count; wait->flags = flags; wait->user = NULL; + wait->waking = 0; current->wait = wait; if (flags & SELECT_TIMEOUT) { @@ -495,6 +499,9 @@ static int check_wait( struct thread *th struct thread_wait *wait = thread->wait; struct wait_queue_entry *entry = wait->queues; + /* If we are already waking this thread, no need to wake it again */ + if (wait->waking) return -1; + /* Suspended threads may not acquire locks, but they can run system APCs */ if (thread->process->suspend + thread->suspend > 0) { -- 1.4.1