qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] experience with SDL2, event loop & main thread


From: Fam Zheng
Subject: Re: [Qemu-devel] experience with SDL2, event loop & main thread
Date: Mon, 12 Dec 2016 11:35:12 +0800
User-agent: Mutt/1.7.1 (2016-10-04)

On Sat, 12/10 18:16, Liviu Ionescu wrote:
> conclusions:
> 
> - the graphical event loop and all graphical primitives must be called from 
> the main thread context
> - in qemu this is not possible directly; an inefficient but functional
> solution uses a timer programmed to call a function every few milliseconds, to
> poll the event loop. (if the qemu I/O event loop is executed on the main
> thread, the timer function will be called from the main thread context)

Isn't it possible to notify the main thread with an EventNotifier and process
the deferred events in its handler?

Fam

> - all graphical operations initiated by the all other thread (like the 
> emulator thread), must be deferred (in SDL using user events) to the 
> graphical event loop
> - a function to run graphical destruction must be registered with atexit()
> - only the main thread can call exit(), to ensure the destruction functions 
> are not called from other threads
> - exiting from other threads must be also deferred to the main thread, 
> possibly with unlocking a mutex.
> 
> 
> I hope that helps,
> 
> Liviu
> 
> 
> 
> 
> 
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]