player lock fix
This commit is contained in:
@@ -5039,9 +5039,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
|
|
||||||
//if(!newSystem)
|
//if(!newSystem)
|
||||||
// return;
|
// return;
|
||||||
|
ReentrantReadWriteLock reentrantLock = (ReentrantReadWriteLock) updateLock;
|
||||||
|
|
||||||
if (((ReentrantReadWriteLock) this.updateLock).isWriteLockedByCurrentThread()) {
|
// Check if the lock is currently held by another thread (either for reading or writing)
|
||||||
this.updateLock.writeLock().unlock();
|
if (reentrantLock.isWriteLocked() || reentrantLock.getReadLockCount() > 0) {
|
||||||
|
return; // Or throw an exception if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.updateLock.writeLock().tryLock()) {
|
if (this.updateLock.writeLock().tryLock()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user