add commented out thread assertion

I want to use ReentrantLock instead of my implementation but I'm
breaking its rule that the thread that locks a lock must be the one to
unlock it. Add commented-out assertion for some later time when I might
want to fix this. No change for now.
This commit is contained in:
Eric House 2016-08-10 09:42:19 -07:00
parent dddfa2e269
commit 43b76d24cc

View file

@ -36,6 +36,7 @@ public class GameLock {
private long m_rowid;
private boolean m_isForWrite;
private int m_lockCount;
private Thread m_ownerThread;
private StackTraceElement[] m_lockTrace;
static {
@ -76,6 +77,9 @@ public class GameLock {
if ( null == owner ) { // unowned
Assert.assertTrue( 0 == m_lockCount );
s_locks.put( m_rowid, this );
if ( BuildConfig.DEBUG ) {
m_ownerThread = Thread.currentThread();
}
++m_lockCount;
gotIt = true;
@ -172,6 +176,10 @@ public class GameLock {
// DbgUtils.logf( "GameLock.unlock(%s)", m_path );
synchronized( s_locks ) {
Assert.assertTrue( this == s_locks.get(m_rowid) );
// Need to get this working before can switch to using ReentrantLock
// if ( BuildConfig.DEBUG ) {
// Assert.assertTrue( Thread.currentThread().equals(m_ownerThread) );
// }
if ( 1 == m_lockCount ) {
s_locks.remove( m_rowid );
} else {