Re: multithreaded apps



Hi,

Paul, thanks for the code you've send. After making that small app and
seeing it works how I want it to work, I've come to the conclusion that
this is what I want. 

In few words here is what I want to do:
- a simulation program that is doing time expencive computings and that
can run for hours.
- the simulation will start with an arbitrary solution and it will try
to improve it till the right one is reached within a given error by
means os succesive iterations.
- after each iteration, the program should plot the current solution
(aka distribution of electric field and space charges).
- i should be able to control the runing of the simulation at any moment
(by being able to stop/pause/continue it).

(The test program tries to simulate the simulation, by implementing a
start/stop button and writing those messages in the text entry.)

I was thinking to use an IO to notify the main thread that some data are
ready for being displayed. But it is easier and more straigth forward
just to lock the gtk thread and do my graphic stuff. I think this will
also make my program a bit easier to read.

Paul Barton-Davis wrote:
> 
> using gdk_threads_{enter,leave} is fine if you don't have performance
> considerations that might be affected by the X event loop.

What do you mean by this ? That my threaded app will have to wait gtk to
finish processing all the pending events ? If this is the performance
thing I have to consider, then it is ok: I don't mind about this, it is
not that critical. If you ment something else, please explain me a bit
more: multi-threaded stuff still a bit unclear to me. Actually, this
small example is my first attempt to do such a thing in linux.

Any comments || sugestions are wellcome.

TIA,

Ionutz
-- 
Mental backup in progress - Do Not Disturb!
--
http://borco-ei.eng.hokudai.ac.jp/~borco/



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