mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Improve acquisition performance, fix current thread lock not being occupied
This commit is contained in:
parent
23664292de
commit
8123e839ec
@ -333,7 +333,9 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
//players.add(p1.getAcquiredElement());
|
||||
p1.getAcquiredElement().acquire(o -> {
|
||||
for (Player p2 : MinecraftServer.getConnectionManager().getOnlinePlayers())
|
||||
p2.getAcquiredElement().acquire(o2 -> {});
|
||||
p2.getAcquiredElement().acquire(o2 -> {
|
||||
//System.out.println(getAcquiredElement().getHandler().getBatchThread().monitor.isOccupiedByCurrentThread());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,9 @@ public final class Acquisition {
|
||||
|
||||
GLOBAL_MONITOR.enter();
|
||||
|
||||
if (currentAcquired)
|
||||
current.monitor.enter();
|
||||
|
||||
final var monitor = elementThread.monitor;
|
||||
final boolean acquired = monitor.isOccupiedByCurrentThread();
|
||||
if (!acquired) {
|
||||
@ -102,8 +105,6 @@ public final class Acquisition {
|
||||
monitor.leave();
|
||||
}
|
||||
GLOBAL_MONITOR.leave();
|
||||
if (currentAcquired)
|
||||
current.monitor.enter();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user