fix: exit condition handling
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
parent
227ab3f45d
commit
f78bb963fb
|
@ -67,7 +67,7 @@ proc midiEventPrinterProc() {.thread.} =
|
||||||
|
|
||||||
dataReadyLock.acquire()
|
dataReadyLock.acquire()
|
||||||
|
|
||||||
while not exitLoop:
|
while true:
|
||||||
while not exitLoop and ringbufferReadSpace(rb) >= 4:
|
while not exitLoop and ringbufferReadSpace(rb) >= 4:
|
||||||
var read = cast[int](ringbufferRead(rb, cast[cstring](recvBuf.addr), 4))
|
var read = cast[int](ringbufferRead(rb, cast[cstring](recvBuf.addr), 4))
|
||||||
|
|
||||||
|
@ -78,6 +78,9 @@ proc midiEventPrinterProc() {.thread.} =
|
||||||
stdout.write("\n")
|
stdout.write("\n")
|
||||||
stdout.flushFile()
|
stdout.flushFile()
|
||||||
|
|
||||||
|
if exitLoop:
|
||||||
|
break
|
||||||
|
|
||||||
dataReady.wait(dataReadyLock)
|
dataReady.wait(dataReadyLock)
|
||||||
|
|
||||||
dataReadyLock.release()
|
dataReadyLock.release()
|
||||||
|
|
Loading…
Reference in New Issue