Fixed bugs introduced into Monitor when adding debug info and simplifying.
This commit is contained in:
@@ -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//
|
||||
|
||||
Reference in New Issue
Block a user