Re: Real Time Drawing



On Mon, 14 Mar 2005 12:48:04 -0500
"Liam R. E. Quin" <liam holoweb net> wrote:

On Mon, 2005-03-14 at 17:18 +0000, Athanasios Anastasiou wrote:

There are two threads of execution, one is handling reading and
decoding of the incoming stream of data and the other is handling
processing.

Multi-threaded applications sometimes get into trouble if more than one
thread is trying to communicate with the X server at the same time.

An alternate architecture (I don't know how easy it is for you to
contemplate the change, though, of course) is to use gtk_add_input
(or whatever it's called) to get a callback whenever there's data
available on the serial port, and use only a single thread.  But if
you do a lot of processing, separate threads can be a win, especially
on a multi-CPU system :-)

Those are probably iochannels you're looking for. g_io_add_watch and
friends are documented in the glib reference manual... I've used them
several times, and this solution is by far simpler than threads, and I've
never lost data...

John



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