mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 06:11:46 +00:00
[client] added clean client restart mechanisim
This commit is contained in:
parent
a216655582
commit
3bc2506d92
1 changed files with 14 additions and 7 deletions
|
@ -146,17 +146,24 @@ int renderThread(void * unused)
|
|||
struct KVMFRHeader header;
|
||||
volatile uint32_t * updateCount = &state.shm->updateCount;
|
||||
|
||||
ivshmem_kick_irq(state.shm->guestID, 0);
|
||||
while(state.running)
|
||||
const struct timespec s =
|
||||
{
|
||||
// poll until we have a new frame, or we time out
|
||||
while(header.updateCount == *updateCount && state.running) {
|
||||
const struct timespec s = {
|
||||
.tv_sec = 0,
|
||||
.tv_nsec = 1000
|
||||
};
|
||||
|
||||
// flag the host that we are starting up this is important so that
|
||||
// the host wakes up if it is waiting on an interrupt, the host will
|
||||
// also send us the current mouse shape since we won't know it yet
|
||||
__sync_or_and_fetch(&state.shm->flags, KVMFR_HEADER_FLAG_RESTART);
|
||||
while(state.running && (state.shm->flags & KVMFR_HEADER_FLAG_RESTART))
|
||||
nanosleep(&s, NULL);
|
||||
|
||||
while(state.running)
|
||||
{
|
||||
// poll until we have a new frame, or we time out
|
||||
while(header.updateCount == *updateCount && state.running)
|
||||
nanosleep(&s, NULL);
|
||||
}
|
||||
|
||||
if (!state.running)
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue