mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 21:43:40 +00:00
[client] common: added spin timeout to framebuffer wait
This commit is contained in:
parent
c8f740c34e
commit
6799d518a5
@ -39,9 +39,14 @@ const size_t FrameBufferStructSize = sizeof(FrameBuffer);
|
||||
|
||||
void framebuffer_wait(const FrameBuffer * frame, size_t size)
|
||||
{
|
||||
while(atomic_load_explicit(&frame->wp, memory_order_acquire) < size) {
|
||||
while(atomic_load_explicit(&frame->wp, memory_order_acquire) < size)
|
||||
{
|
||||
int spinCount = 0;
|
||||
while(frame->wp < size)
|
||||
{
|
||||
if (++spinCount == FB_SPIN_LIMIT)
|
||||
return;
|
||||
usleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user