Re: Multithreaded gtk apps
- From: Phillip Susi <psusi ubuntu com>
- To: Andy Spencer <andy753421 gmail com>
- Cc: ML-gtk <gtk-list gnome org>, Paul Davis <paul linuxaudiosystems com>
- Subject: Re: Multithreaded gtk apps
- Date: Mon, 14 Jan 2013 09:53:46 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 1/13/2013 11:46 PM, Andy Spencer wrote:
> On 2013-01-13 23:21, Paul Davis wrote:
>> just stop doing all of this.
>>
>> ensure that there is only 1 thread making calls to GTK/GDK/X.
>>
>> if other threads need to get graphical work done, use
>> g_idle_add() or its cousins.
>
> Sadly, this is what I recommend as well, especially if you ever
> want to run on win32. I would caution against overuse of g_idle_add
> though.
>
> Recently I've been saving off the data from the thread and then
> doing the GUI updates at the start of the next expose/draw. That's
> worked a lot better for me than idle callbacks, but that's just my
> own experiences, it might not work so well if you're trying to show
> a dialog box.
So the official documentation is wrong?
I need to return the results of the dialog box so an idle won't work
for me. I was thinking about a closure maybe? But I can't find a C++
binding for them.
My other thought was to acquire the main context and run the main loop
in the background thread for the duration of the dialog box, but it
seems that the foreground thread must willingly release the main
context rather than have it temporarily stolen while it is blocked.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJQ9Bv6AAoJEJrBOlT6nu75/gkH/i4jOh9/2zE/ZXu+JbQQgSfC
8+FolvDs5rEtNmmuJ3nlWlG3aigIC6Yp5Flpm9T9goA/AXsDCKeHaLukLjUfPP8B
auCnkUuXL1irgsjo48sxM2CY28gstBP2M0yHR5gWAXWG/pP2kkwSEZrnxBmRns99
tiXpfWo1YBxYZ9aLjRADDp0qJVhDSC7e4nnDHaV7PG19NWewlUadYD3XhcTUmtWI
A5Q2qww4P1eflUl+VLt0BbYH+tO1xiaFI8aU3sqhzBoauzLxPw7C2hVQiHQYNIxj
EZOuGyOo8qXhuGuCcTJkMl3EDPGJwRhKCovBYELNTPTEVk0VriucywOShfbkiig=
=aXZL
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]