File tree Expand file tree Collapse file tree
robocode.host/src/main/java/net/sf/robocode/host/security Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,11 +94,11 @@ public void start(IThreadManager threadManager) {
9494 */
9595 public boolean waitForStop () {
9696 boolean isAlive = false ;
97-
98- if (runThread != null && runThread .isAlive ()) {
99- runThread .interrupt ();
100- waitForStop (runThread );
101- isAlive = runThread .isAlive ();
97+ Thread thr = runThread ; // forceStop() can set to null concurrently
98+ if (thr != null && thr .isAlive ()) {
99+ thr .interrupt ();
100+ waitForStop (thr );
101+ isAlive = thr .isAlive ();
102102 }
103103
104104 Thread [] threads = new Thread [100 ];
@@ -108,7 +108,7 @@ public boolean waitForStop() {
108108 }
109109
110110 for (Thread thread : threads ) {
111- if (thread != null && thread != runThread && thread .isAlive ()) {
111+ if (thread != null && thread != thr && thread .isAlive ()) {
112112 thread .interrupt ();
113113 waitForStop (thread );
114114 isAlive |= thread .isAlive ();
You can’t perform that action at this time.
0 commit comments