Re: Thread communication



On 13 Feb 2002, Gustavo Carneiro wrote:

On Tue, 2002-02-12 at 17:39, Lennartsson, Andreas wrote:
Hi,

I am using Gtk 1.2. My application main and a communication thread. I spawn
the communication thread just before I call gtk_main. My idea was to emit a
emit a signal int the communication thread, using gtk_signal_emit_by_name.

Why use a thread at all? Thread is usefull only on multiprocessor systems
or in systmes with problems notifying on events on filedescriptors (eg
Windows) In Unix you do poll or select, and in gtk you do a

gdk_input_add( fd, GDK_INPUT_READ, GTK_SIGNAL_FUNC(file_function),
&cmdinfo );

(Where fd could be a socket). If you have a lot of communication your
design should go into an arrangement where you have several processes.

GH

----------------------------------------------------------------
Göran Hasse            email: gh raditex se     Tel: 08-6949270
Raditex AB             http://www.raditex.se
Sickla Alle 7, 1tr                              Mob: 070-5530148
131 34  NACKA, SWEDEN





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