Re: Real Time Drawing



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 :-)


2. Some times i get some error messages from the X Window Server and 
some times i get Critical Errors from GDK.

Without seeing the errors it's hard to be certain what's happening.
You might be suffering from memory corruption (e.g. try valgrind or
memprof) e.g. by writing to an object that you didn't actually
allocate... but if it seems to be related to timing, I'd suspect
that you are calling gtk or X functions from multiple threads,
which isn't always safe.

Also, a timer set to 20 milliseconds is likely to be more than
adequate, too, and will look pretty up-to-date for most applications.
Unset it when you don't need it, to save CPU usage.

Liam


-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin
Pictures from old books: http://www.holoweb.net/~liam/pictures/oldbooks/
IRC (chat) programs: www.ircreviews.org/clients/




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