Re: blocked gui - threading problem?
- From: Ondrej Tuma <konference webjet cz>
- To: gtkmm-list gnome org
- Subject: Re: blocked gui - threading problem?
- Date: Mon, 16 Jul 2007 14:39:38 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If you want do this via threads ... (how Klaus wrote, it could be
easier, when you will work only with main thread and signals (you can
use Glib::SignalTimeout for example)), i thing that to use Dispatcher,
you could add to your code only Dispatchers declaration as class
members(values), connection binding of this dispatcher to update and
move methods and in thread function rewrite calling these methods to
calling signals.
I'm only not sure, how you can use signal parameters in Dispatcher. But
in my opinion, why not :)
Ondrej
Daniel Hornung napsal(a):
> On Friday 13 July 2007 18:47, Milosz Derezynski wrote:
>> This requires more information about you code, but just off head said, it's
>> not a good idea to call into Gtk+ from a thread without severe precautions.
>>
>> Can you paste/post your thread's code and maybe also the code responsible
>> for the drawing?
>>
>> Milosz
>
> Bob wrote:
>> I am guessing that your method PlayerWindow::getMove with its nice tight
>> little loop is the culprit. You need to allow the main loop to iterate if
>> it has events (like redrawing stuff) pending from within your wait loop.
>>
>> Bob
>
>
> Hello Milosz, Bob & Ondrej!
>
> Thank you for your comments, I'll try to make things a bit clearer. I pasted
> parts of my code at http://pastebin.com/m7f75d490 and
> http://pastebin.com/m182b811
>
> Ondrej suggested using signals to communicate between window and thread, but
> that would mean quite some rewriting :-( And would it solve the problem?
>
> Even when I make the sleep times in getMove() much longer or much shorter, the
> problem occurs only sometimes, not every time. Most of the time it repaints
> everything alright while sleeping.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGm2cKBmNIPxOnb/IRAtb6AJ46596Rk5+qs1xryBzYN2m1AAHCbgCgwOw5
qfiTINu/vWeHtkqfn68pawU=
=nyrY
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]