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

Roberto Diaz wrote:
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:
code which draws in a drawing area.. (is a loop)

Nope, you would have to place the global lock around the calls, not the

I think you're doing it wrong.  There is no need for using threads, use
an event driven model instead, using the GTK+ and GDK event

I'm curious ... please read the following web pages from end to end and
then tell me how you can justify this additional effort of threads ...
'cause I haven't yet found a good justification.


"Why Threads Are A Bad Idea (for most purposes). Talk presented as an
Invited Talk at the 1996 USENIX Technical Conference (January 25, 1996).
The talk compares the threads style of programming to an alternative
approach, events, that use only a single thread of control. Although
each approach has its weaknesses, events result in simpler, more
manageable code than threads, with efficiency that is generally as good
as or better than threads. Most of the applications for which threading
is currently recommended (including nearly all user-interface
applications) would be better off with an event-based implementation."

James Cameron                                 (james cameron compaq com)

http://quozl.linux.org.au/         (or)         http://quozl.netrek.org/

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