mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 13:33:40 +00:00
[c-host] don't hog CPU resources if queues are full
This commit is contained in:
parent
29e5f193f0
commit
228f5bfdff
@ -117,6 +117,13 @@ static int frameThread(void * opaque)
|
||||
|
||||
while(app.running)
|
||||
{
|
||||
//wait until there is room in the queue
|
||||
if(lgmpHostQueuePending(app.frameQueue) == LGMP_Q_FRAME_LEN)
|
||||
{
|
||||
usleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(app.iface->waitFrame(&frame))
|
||||
{
|
||||
case CAPTURE_RESULT_OK:
|
||||
@ -149,13 +156,6 @@ static int frameThread(void * opaque)
|
||||
}
|
||||
}
|
||||
|
||||
//wait until there is room in the queue
|
||||
if (lgmpHostQueuePending(app.frameQueue) == LGMP_Q_FRAME_LEN)
|
||||
{
|
||||
if (!app.running)
|
||||
break;
|
||||
}
|
||||
|
||||
LGMP_STATUS status;
|
||||
|
||||
// if we are repeating a frame just send the last frame again
|
||||
@ -364,7 +364,10 @@ void capturePostPointerBuffer(CapturePointer pointer)
|
||||
while ((status = lgmpHostQueuePost(app.pointerQueue, flags, mem)) != LGMP_OK)
|
||||
{
|
||||
if (status == LGMP_ERR_QUEUE_FULL)
|
||||
{
|
||||
usleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG_ERROR("lgmpHostQueuePost Failed (Pointer): %s", lgmpStatusString(status));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user