mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
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:
parent
dddfa2e269
commit
43b76d24cc
1 changed files with 8 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue