mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[host] syncronization improvements
This commit is contained in:
parent
f767f32a32
commit
3bc6f29dc3
@ -145,34 +145,6 @@ bool Service::Process()
|
||||
return false;
|
||||
}
|
||||
|
||||
// wait for the host to notify that is it is ready to proceed
|
||||
bool eventDone = false;
|
||||
while (!eventDone)
|
||||
{
|
||||
switch (WaitForSingleObject(m_readyEvent, 1000))
|
||||
{
|
||||
case WAIT_ABANDONED:
|
||||
DEBUG_ERROR("Wait abandoned");
|
||||
return false;
|
||||
|
||||
case WAIT_OBJECT_0:
|
||||
eventDone = true;
|
||||
break;
|
||||
|
||||
// if we timed out we just continue to ring until we get an answer or we are stopped
|
||||
case WAIT_TIMEOUT:
|
||||
continue;
|
||||
|
||||
case WAIT_FAILED:
|
||||
DEBUG_ERROR("Wait failed");
|
||||
return false;
|
||||
|
||||
default:
|
||||
DEBUG_ERROR("Unknown error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// copy the frame details into the header
|
||||
header->width = frame.width;
|
||||
header->height = frame.height;
|
||||
@ -193,6 +165,33 @@ bool Service::Process()
|
||||
return false;
|
||||
}
|
||||
|
||||
// wait for the host to notify that is it is ready to proceed
|
||||
bool eventDone = false;
|
||||
while (!eventDone)
|
||||
{
|
||||
switch (WaitForSingleObject(m_readyEvent, 1000))
|
||||
{
|
||||
case WAIT_ABANDONED:
|
||||
DEBUG_ERROR("Wait abandoned");
|
||||
return false;
|
||||
|
||||
case WAIT_OBJECT_0:
|
||||
eventDone = true;
|
||||
break;
|
||||
|
||||
case WAIT_TIMEOUT:
|
||||
continue;
|
||||
|
||||
case WAIT_FAILED:
|
||||
DEBUG_ERROR("Wait failed");
|
||||
return false;
|
||||
|
||||
default:
|
||||
DEBUG_ERROR("Unknown error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (++m_frameIndex == 2)
|
||||
m_frameIndex = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user