Re: Real Time Drawing
- From: Athanasios Anastasiou <thanos atmail com>
- To: John Cupitt <jcupitt gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Real Time Drawing
- Date: Wed, 16 Mar 2005 09:14:38 +0000
Thanks for your email and the helpful information John.
After some directions from Liam (see yesterdays mailing archive) i
passed my app through valgrind and found out that there are too many
errors happening in the GTK / X level. I suppose that it has something
to do with the way i am using the thread library in combination with GTK.
I refrained from using the callback mechanism ( as you suggest) because
whatever code is executed within there should execute in a time shorter
than the "packet length".
I am dealing with a system which can not afford droping packets. So, one
thread of execution reads and decodes from the serial port no matter
what the rest of the app is doing, and a second thread is doing the
processing. Probably a third thread will be handling display at a later
stage. The threads communicate through a double linked list with mutex
protection so that it is guaranteed that writting and reading is
occuring at different memory addresses.
You are talking about a GAsyncQueue, now thats something i havent looked
at. Another thing i havent looked at is threads in glib....I suspect
that a lot of bad things occur when my "processing" thread tries to draw
the signal on the widget because at some point i discovered that the
thread lags and blocks (mind you there is nothing else in the processing
thread except the plot code)
I see the point in the structure you suggest. I also tried that
yesterday (Not exactly as you describe it but the idea is the same). The
ReadAndDecode thread does its stuff and the processing thread
invalidates the widget where the samples are to be drawn, the expose
event handler handles the rest...... (And the question now arrises, what
happens if an expose event from the app collides with an expose event
that had to be sent because the user minimized and maximized the
application???)
I also used pipes before i start coding for the main application to
check that i had the decoding of the data frame correct. The decoded
data was plotted through a pipe to gnuplot!!!
Still there are the same problems and i am suspecting that its in the
developers responsibility to take care of thread safety in GTK, is that
true? (i will also be reading on that, but any suggestions / ideas are
wellcome)
Thanks for the suggestion of the books also, they look good.
All the best.
thanOS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]