Re: blocked gui - threading problem?



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.

Any idea? Thanks a lot!
Daniel

Attachment: pgpMbcLf8YCgr.pgp
Description: PGP signature



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