[Glade-users] glade and thread-safe code...



GTK+ has a global lock which you must get with GDK_THREADS_ENTER
before calling any GTK+ code. (And release with GDK_THREADS_LEAVE.)
I think GLib is thread-safe - it handles any locking needed itself.
I think people normally keep all GUI code in one thread and use other
threads for background tasks etc.

Yes but lets suppose I want to have a thread recieving remote data (which
are just points) and draw these points in a drawing area...

If I start protecting my code with the global lock:

GDK_THREADS_ENTER..

code which draws in a drawing area.. (is a loop)

GDK_THREADS_LEAVE.

since my thread is painting all the time (so for this I want it to be 
a thread).. it never release the global lock...

What effect can have this in the main GUI thread? for example if a get an
exposure event.. and I want to repaint some part.. will I need to have the
lock?.. must I notify this to the "paint thread" and let it die (for
example)?.. 


Regards

Roberto


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com






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