Re: Help with a multi-threaded application. Spot a crash.



On 31 May 2012 07:11, Osmo Antero <osmoma gmail com> wrote:
The actual code has also a LockedCounter (mutex controlled) object
that feeds each thread with a unique sequence number. Only the thread
with highest sequence number can tick and change the GUI, others will
simply die away.

I expect you know, but this is not the recommended way to write
threaded GUIs with gtk. It will not be portable.

Best practice is to have a single "main" GUI thread doing all gtk_*()
calls. Worker threads can send data to the main GUI thread for display
with g_idle_add() and friends. You don't need any explicit locking if
you do it this way, which is nice.

John



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