Need a lock on the list as we update it between threads

master
sigonasr2 2 years ago
parent e589001985
commit 016fb611af
  1. 6
      sig/App.java

@ -394,7 +394,8 @@ class Server
@Override @Override
public void run() { public void run() {
while (true){ while (true){
for (String command:commandQueue){ synchronized (commandQueue){
commandQueue.forEach((command)->{
switch (command){ switch (command){
case "FOLLOW":{ case "FOLLOW":{
PressKeyWithModifier(KeyEvent.VK_CONTROL,KeyEvent.VK_7); PressKeyWithModifier(KeyEvent.VK_CONTROL,KeyEvent.VK_7);
@ -453,8 +454,9 @@ class Server
System.out.println("Unknown command: "+command); System.out.println("Unknown command: "+command);
} }
} }
} });
commandQueue.clear(); commandQueue.clear();
}
if (queueUpSprint&&nextActionTimer==0){ if (queueUpSprint&&nextActionTimer==0){
PressKey(KeyEvent.VK_N); PressKey(KeyEvent.VK_N);

Loading…
Cancel
Save