[client] adjustments for better sync

This commit is contained in:
Geoffrey McRae 2018-05-24 11:26:09 +10:00
parent b29f1c62bb
commit c42bff99e2

View File

@ -216,11 +216,9 @@ int cursorThread(void * unused)
if(!(state.shm->cursor.flags & KVMFR_CURSOR_FLAG_UPDATE)) if(!(state.shm->cursor.flags & KVMFR_CURSOR_FLAG_UPDATE))
{ {
if (!state.running) if (!state.running)
break; return 0;
// cursor shape updates are not so critical usleep(1000);
// only check for udpates once every 15ms
usleep(150000);
continue; continue;
} }
@ -272,7 +270,7 @@ int cursorThread(void * unused)
} }
// now we have taken the mouse data, we can flag to the host we are ready // now we have taken the mouse data, we can flag to the host we are ready
__sync_and_and_fetch(&state.shm->cursor.flags, ~KVMFR_CURSOR_FLAG_UPDATE); state.shm->cursor.flags = 0;
if (header.flags & KVMFR_CURSOR_FLAG_POS) if (header.flags & KVMFR_CURSOR_FLAG_POS)
{ {
@ -309,9 +307,9 @@ int frameThread(void * unused)
if (!state.running) if (!state.running)
break; break;
// allow for a maximum refresh of 200fps (1000/200 = 5ms), this should // allow for a maximum refresh of 400fps (1000/400 = 2.5ms), this should
// befreqent enough without chewing up too much CPU time // befreqent enough without chewing up too much CPU time
usleep(5000); usleep(2500);
continue; continue;
} }