From 3674b4ed96a2fc8df4910d012dc123260bb93bf4 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 1 Mar 2019 12:42:12 +1100 Subject: [PATCH] [c-host] added cursor and frame thread stubs --- c-host/app.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/c-host/app.c b/c-host/app.c index 909f0a34..87533695 100644 --- a/c-host/app.c +++ b/c-host/app.c @@ -21,6 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include #include +#include #include "debug.h" #include "capture/interfaces.h" #include "KVMFR.h" @@ -40,10 +41,28 @@ struct app unsigned int frameSize; uint8_t * frame[MAX_FRAMES]; unsigned int frameOffset[MAX_FRAMES]; + + bool running; + osThreadHandle * cursorThread; + osThreadHandle * frameThread; }; static struct app app; +static int cursorThread(void * opaque) +{ + while(app.running) + usleep(10000); + return 0; +} + +static int frameThread(void * opaque) +{ + while(app.running) + usleep(10000); + return 0; +} + int app_main() { unsigned int shmemSize = os_shmemSize(); @@ -109,10 +128,32 @@ int app_main() } DEBUG_INFO("Capture Size : %u MiB (%u)", maxFrameSize / 1048576, maxFrameSize); + if (!os_createThread("CursorThread", cursorThread, NULL, &app.cursorThread)) + { + DEBUG_ERROR("Failed to create the cursor thread"); + exitcode = -1; + goto exit; + } + + if (!os_createThread("FrameThread", frameThread, NULL, &app.frameThread)) + { + DEBUG_ERROR("Failed to create the frame thread"); + exitcode = -1; + goto exit_cursor_thread; + } + iface->capture(); iface->capture(); iface->capture(); +//finish: + app.running = false; + if (!os_joinThread(app.frameThread, NULL)) + DEBUG_WARN("Failed to join the cursor thread"); +exit_cursor_thread: + app.running = false; + if (!os_joinThread(app.cursorThread, NULL)) + DEBUG_WARN("Failed to join the cursor thread"); exit: iface->deinit(); iface->free();