[c-host] fix deadlock when there is no update

This commit is contained in:
Geoffrey McRae 2019-03-04 10:16:51 +11:00
parent eedde4abcb
commit 8df850023c

View file

@ -71,8 +71,8 @@ static int pointerThread(void * opaque)
pointer->data = app.pointerData; pointer->data = app.pointerData;
if (!app.iface->getPointer(&pointer)) if (!app.iface->getPointer(&pointer))
DEBUG_ERROR("Failed to get the pointer"); DEBUG_ERROR("Failed to get the pointer");
os_signalEvent(app.updateEvent);
#endif #endif
os_signalEvent(app.updateEvent);
} }
DEBUG_INFO("Cursor thread stopped"); DEBUG_INFO("Cursor thread stopped");
@ -303,6 +303,7 @@ int app_main()
bool frameUpdate = false; bool frameUpdate = false;
bool pointerUpdate = false; bool pointerUpdate = false;
retry_capture:
switch(iface->capture(&frameUpdate, &pointerUpdate)) switch(iface->capture(&frameUpdate, &pointerUpdate))
{ {
case CAPTURE_RESULT_OK: case CAPTURE_RESULT_OK:
@ -342,6 +343,9 @@ int app_main()
goto finish; goto finish;
} }
if (!frameUpdate && !pointerUpdate)
goto retry_capture;
if (frameUpdate && !os_signalEvent(app.frameEvent)) if (frameUpdate && !os_signalEvent(app.frameEvent))
{ {
DEBUG_ERROR("Failed to signal the frame thread"); DEBUG_ERROR("Failed to signal the frame thread");