* src/threads/posix/thread-posix.h: Removed sleeping flag.
authorStefan Ring <stefan@complang.tuwien.ac.at>
Fri, 13 Jun 2008 17:17:41 +0000 (19:17 +0200)
committerStefan Ring <stefan@complang.tuwien.ac.at>
Fri, 13 Jun 2008 17:17:41 +0000 (19:17 +0200)
* src/threads/posix/thread-posix.c: Likewise.
* src/threads/posix/lock.c: Likewise.

--HG--
extra : transplant_source : %A33%F7%92%CA%07%C3%96%DC%3F%80%15%BC%BE%D7%1A%D5%98%DA%D8

src/threads/posix/lock.c
src/threads/posix/thread-posix.c
src/threads/posix/thread-posix.h

index 4d69503ba8a2824b904c0a5d11aa26a2f872b271..71e5a0077132212fb2704d721e2057344bf81e7b 100644 (file)
@@ -1418,17 +1418,10 @@ static void lock_record_notify(threadobject *t, lock_record_t *lr, bool one)
 
                mutex_lock(&(waitingthread->waitmutex));
 
-               DEBUGLOCKS(("[lock_record_notify: lr=%p, t=%p, waitingthread=%p, sleeping=%d, one=%d]",
-                                       lr, t, waitingthread, waitingthread->sleeping, one));
+               DEBUGLOCKS(("[lock_record_notify: lr=%p, t=%p, waitingthread=%p, one=%d]",
+                                       lr, t, waitingthread, one));
 
-               /* Signal the thread if it's sleeping. sleeping can be false
-                  when the waiting thread is blocked between giving up the
-                  monitor and entering the waitmutex. It will eventually
-                  observe that it's signaled and refrain from going to
-                  sleep. */
-
-               if (waitingthread->sleeping)
-                       pthread_cond_signal(&(waitingthread->waitcond));
+               pthread_cond_signal(&(waitingthread->waitcond));
 
                /* Mark the thread as signaled. */
 
index 9ed9ad8e8df439a93c7bd74316df1da1042e2e77..03ac51f84839c2ac36deaddd35571ea9cf407bdb 100644 (file)
@@ -721,7 +721,6 @@ void threads_impl_thread_clear(threadobject *t)
 
        t->interrupted = false;
        t->signaled = false;
-       t->sleeping = false;
 
        t->suspended = false;
        t->suspend_reason = 0;
@@ -1615,10 +1614,6 @@ static void threads_wait_with_timeout(threadobject *t, struct timespec *wakeupTi
 
        mutex_lock(&t->waitmutex);
 
-       /* mark us as sleeping */
-
-       t->sleeping = true;
-
        /* wait on waitcond */
 
        if (wakeupTime->tv_sec || wakeupTime->tv_nsec) {
@@ -1645,8 +1640,6 @@ static void threads_wait_with_timeout(threadobject *t, struct timespec *wakeupTi
                }
        }
 
-       t->sleeping    = false;
-
        /* release the waitmutex */
 
        mutex_unlock(&t->waitmutex);
@@ -1737,8 +1730,7 @@ void threads_thread_interrupt(threadobject *thread)
 
        pthread_kill(thread->tid, SIGHUP);
 
-       if (thread->sleeping)
-               pthread_cond_signal(&thread->waitcond);
+       pthread_cond_signal(&thread->waitcond);
 
        thread->interrupted = true;
 
index 58f7d845c755808d73318481742cd8c8f80e1a76..1431bc2ddeb8a6ce93f9f0f190fb3ce8d1393383 100644 (file)
@@ -138,7 +138,6 @@ struct threadobject {
 
        bool                  interrupted;
        bool                  signaled;
-       bool                  sleeping;
 
        bool                  suspended;    /* is this thread suspended?          */
        s4                    suspend_reason; /* reason for suspending            */