bugfixed race condition
This commit is contained in:
parent
34e7de389c
commit
99b17092e4
1 changed files with 5 additions and 3 deletions
|
@ -116,15 +116,17 @@ public class LogScriptEngine {
|
||||||
/* Only called from the simulation loop */
|
/* Only called from the simulation loop */
|
||||||
private void stepScript() {
|
private void stepScript() {
|
||||||
/* Release script - halt simulation */
|
/* Release script - halt simulation */
|
||||||
if (semaphoreScript == null || semaphoreSim == null) {
|
Semaphore semScript = semaphoreScript;
|
||||||
|
Semaphore semSim = semaphoreSim;
|
||||||
|
if (semScript == null || semSim == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
semaphoreScript.release();
|
semScript.release();
|
||||||
|
|
||||||
/* ... script executing ... */
|
/* ... script executing ... */
|
||||||
|
|
||||||
try {
|
try {
|
||||||
semaphoreSim.acquire();
|
semSim.acquire();
|
||||||
} catch (InterruptedException e1) {
|
} catch (InterruptedException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue