harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r481009 - /harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c
Date Thu, 30 Nov 2006 17:45:19 GMT
Author: gshimansky
Date: Thu Nov 30 09:45:13 2006
New Revision: 481009

URL: http://svn.apache.org/viewvc?view=rev&rev=481009
Log:
Fixed an incorrect assertion in theading, added a big comment why
it wasn't correct.


Modified:
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c?view=diff&rev=481009&r1=481008&r2=481009
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_thin_monitor.c Thu Nov 30 09:45:13
2006
@@ -197,8 +197,18 @@
             hythread_resume(owner);
     }
 
-   /* status = hymutex_unlock(TM_LOCK);*/
-    assert(!IS_RESERVED(*lockword_ptr));
+    /* status = hymutex_unlock(TM_LOCK);*/
+
+    // Gregory - This lock, right after it was unreserved, may be
+    // inflated by another thread and therefore instead of recursion
+    // count and reserved flag it will have the fat monitor ID. The
+    // assertion !IS_RESERVED(lockword) fails in this case. So it is
+    // necessary to check first that monitor is not fat.
+    // To avoid race condition between checking two different
+    // conditions inside of assert, the lockword contents has to be
+    // loaded before checking.
+    lockword = *lockword_ptr;
+    assert(IS_FAT_LOCK(lockword) || !IS_RESERVED(lockword));
     return TM_ERROR_NONE;
 }
 #else



Mime
View raw message