R: resolve thread deadlock during bolus stop

This commit is contained in:
Milos Kozak 2017-12-03 20:10:54 +01:00
parent 2b2d729f42
commit 4c3e26d19c
2 changed files with 8 additions and 1 deletions

View file

@ -433,7 +433,7 @@ public class DanaRExecutionService extends Service {
}
final Object o = new Object();
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusingInterrupted", new Callback() {
ConfigBuilderPlugin.getCommandQueue().independentConnect("bolusingInterrupted", new Callback() {
@Override
public void run() {
if (danaRPump.lastBolusTime.getTime() > System.currentTimeMillis() - 60 * 1000L) { // last bolus max 1 min old

View file

@ -135,6 +135,13 @@ public class CommandQueue {
}
}
public static void independentConnect(String reason, Callback callback) {
CommandQueue tempCommandQueue = new CommandQueue();
tempCommandQueue.readStatus(reason, callback);
QueueThread tempThread = new QueueThread(tempCommandQueue);
tempThread.start();
}
// returns true if command is queued
public boolean bolus(DetailedBolusInfo detailedBolusInfo, Callback callback) {
if (isRunning(Command.CommandType.BOLUS)) {