From 9e3a42cb626c9184f62698976a06ccaf6b7f84bf Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 3 Aug 2020 12:04:14 +1000 Subject: [PATCH] [host] don't stop the timer when restarting capture --- host/src/app.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/host/src/app.c b/host/src/app.c index 44f83cb2..bc12f6c2 100644 --- a/host/src/app.c +++ b/host/src/app.c @@ -206,12 +206,6 @@ static int frameThread(void * opaque) bool startThreads() { app.running = true; - if (!lgCreateTimer(100, lgmpTimer, NULL, &app.lgmpTimer)) - { - DEBUG_ERROR("Failed to create the LGMP timer"); - return false; - } - if (!lgCreateThread("FrameThread", frameThread, NULL, &app.frameThread)) { DEBUG_ERROR("Failed to create the frame thread"); @@ -235,12 +229,6 @@ bool stopThreads() } app.frameThread = NULL; - if (app.lgmpTimer) - { - lgTimerDestroy(app.lgmpTimer); - app.lgmpTimer = NULL; - } - return ok; } @@ -539,6 +527,12 @@ int app_main(int argc, char * argv[]) LG_LOCK_INIT(app.pointerLock); + if (!lgCreateTimer(100, lgmpTimer, NULL, &app.lgmpTimer)) + { + DEBUG_ERROR("Failed to create the LGMP timer"); + goto fail; + } + if (!captureStart()) { exitcode = -1; @@ -587,8 +581,9 @@ int app_main(int argc, char * argv[]) finish: stopThreads(); -exit: +exit: + lgTimerDestroy(app.lgmpTimer); LG_LOCK_FREE(app.pointerLock); iface->deinit();