Fixed bugs introduced into Monitor when adding debug info and simplifying.

This commit is contained in:
wcrisman
2014-07-11 17:13:25 -07:00
parent 985228d213
commit 0081ad43b9

View File

@@ -276,8 +276,8 @@ public static void unlock(Monitor monitor) {
//Reduce the lock count and clear the lock if zero.//
if(--threadData.lockCount == 0) {
synchronized(monitor.lock) {
monitor.lockingThreadData = null;
monitor.lock.notify();
monitor.lockingThreadData = null;
threadData.currentLock = null;
threadData.lockCount = 0;
threadData.stack = null;
@@ -313,12 +313,12 @@ private static void suspend(ThreadData threadData) {
if(threadData.currentLock != null) {
//Allow another thread to lock the previously held monitor.//
synchronized(threadData.currentLock.lock) {
System.out.println("MONITOR: Suspended lock: " + Integer.toHexString(threadData.currentLock.lock.hashCode()));
threadData.currentLock.lock.notify();
threadData.currentLock.lockingThreadData = null;
threadData.lockCount = 0;
threadData.currentLock = null;
threadData.stack = null;
threadData.currentLock.lock.notify();
System.out.println("MONITOR: Suspended lock: " + Integer.toHexString(threadData.currentLock.lock.hashCode()));
}//synchronized//
}//if//
}//if//