prevent deadlock when more than one thread (or the same more than once) is
authorFilippo Gioachin <gioachin@illinois.edu>
Wed, 6 Apr 2005 08:20:45 +0000 (08:20 +0000)
committerFilippo Gioachin <gioachin@illinois.edu>
Wed, 6 Apr 2005 08:20:45 +0000 (08:20 +0000)
trying to grab the lock of immediate messages. If the grab fails it basically
give up: this means someone is already executing.

src/arch/util/immediate.c

index cac5998e67e46129b3883473a73863937176a9eb..577ecffd17be52bf864c0d3bfd53333c4973fc33 100644 (file)
@@ -93,14 +93,15 @@ void CmiHandleImmediate()
 {
    void *msg;
 
-   /* If somebody else is checking the queue, we don't need to
-   if (CmiTryLock(CsvAccess(NodeState).immRecvLock)!=0) return;
-   */
    /* converse init hasn't finish */
    if (!_immediateReady) return;
   
-   /* Make sure only one thread is running immediate messages: */
+   /* If somebody else is checking the queue, we don't need to */
+   if (CmiTryLock(CsvAccess(NodeState).immRecvLock)!=0) return;
+
+   /* Make sure only one thread is running immediate messages:
    CmiLock(CsvAccess(NodeState).immRecvLock);
+   */
 
    MACHLOCK_ASSERT(!_immRunning,"CmiHandleImmediate");
    _immRunning=1; /* prevents SIGIO reentrancy, and allows different send */