Gtkmm Threads question.



Hello,
happy new year to everyone.

I have created a GUI with a treeview, each row of the treeview
represents a system with its own calculations and results.
Each referred system must  do its calculation in simultaneously, so I
launch a thread (Glib::Thread ) to run each system.
This is working fine and I'm getting the desired result/behavior.

However I want to display the calculated value of each system in the
treeview at already created column named "value".


I had read that only the main thread is allowed to change widget values.
So I must to send the calculated value to the main thread which will
identify the sender system and update the value field of this system in
the treeview.But I'm not reaching the solution for this.

I read about the Glib::Dispatcher and have implemented and I'm
connecting  the signal to the handler with success but I cant pass the
calculated value through it. And I cant also  make something like:
"system[sender_id]->GetValue () " inside the Handler,  because this
object is in a loop function (Run()) so the program will crash if the
try to access the GetValue.

This is simple SingleConsummer (main thread) and multiple producers
(each system thread) configuration.

I'm working in WindowsXP OS, so I think that I cant use Tunnel like in Unix;

What do you suggest me to do? Use Dispatcher, use simple
sigc::signal<void,double> to pass the parameters, what does your
experience tell you?

Thanks,
Filipe







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