[Glade-users] glade and thread-safe code...
- From: james cameron compaq com (James Cameron)
- Subject: [Glade-users] glade and thread-safe code...
- Date: Tue, 14 Nov 2000 12:51:47 +1100
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:
GDK_THREADS_ENTER..
code which draws in a drawing area.. (is a loop)
GDK_THREADS_LEAVE.
Nope, you would have to place the global lock around the calls, not the
loop.
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
infrastructure.
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.
http://www.softpanorama.org/People/Ousterhout/Threads/tsld001.htm
"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]