Implement block/unblock interrupt. Bugzilla #17055.
authorsrinivas%netscape.com
Wed, 29 Dec 1999 16:57:37 +0000
changeset 1020 b8db985be03881dbf9ef17e355b617fa39a38646
parent 1019 ae5c0729dc4975848f9787e54138305610720bdb
child 1021 f9c20b8172cb4c79cd167ba6d788344e5b9578b7
push idunknown
push userunknown
push dateunknown
bugs17055
Implement block/unblock interrupt. Bugzilla #17055.
pr/src/threads/prcthr.c
--- a/pr/src/threads/prcthr.c
+++ b/pr/src/threads/prcthr.c
@@ -166,17 +166,17 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRTh
 {
 #ifdef _PR_GLOBAL_THREADS_ONLY
     PRCondVar *victim;
 
     _PR_THREAD_LOCK(thread);
     thread->flags |= _PR_INTERRUPT;
     victim = thread->wait.cvar;
     _PR_THREAD_UNLOCK(thread);
-    if (NULL != victim) {
+    if ((NULL != victim) && (!(thread->flags & _PR_INTERRUPT_BLOCKED))) {
         int haveLock = (victim->lock->owner == _PR_MD_CURRENT_THREAD());
 
         if (!haveLock) PR_Lock(victim->lock);
         PR_NotifyAllCondVar(victim);
         if (!haveLock) PR_Unlock(victim->lock);
     }
     return PR_SUCCESS;
 #else  /* ! _PR_GLOBAL_THREADS_ONLY */
@@ -189,26 +189,28 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRTh
             _PR_THREAD_LOCK(thread);
             thread->flags |= _PR_INTERRUPT;
         switch (thread->state) {
                 case _PR_COND_WAIT:
                         /*
                          * call is made with thread locked;
                          * on return lock is released
                          */
-                        _PR_NotifyLockedThread(thread);
+						if (!(thread->flags & _PR_INTERRUPT_BLOCKED))
+                        	_PR_NotifyLockedThread(thread);
                         break;
                 case _PR_IO_WAIT:
                         /*
                          * Need to hold the thread lock when calling
                          * _PR_Unblock_IO_Wait().  On return lock is
                          * released. 
                          */
 #if defined(XP_UNIX) || defined(WINNT) || defined(WIN16)
-                        _PR_Unblock_IO_Wait(thread);
+						if (!(thread->flags & _PR_INTERRUPT_BLOCKED))
+                        	_PR_Unblock_IO_Wait(thread);
 #else
                         _PR_THREAD_UNLOCK(thread);
 #endif
                         break;
                 case _PR_RUNNING:
                 case _PR_RUNNABLE:
                 case _PR_LOCK_WAIT:
                 default: