Re: [gtkmm] Re: pthreads with gtk/gtkmm



>> I am using gtkmm1.2: do I have to upgrade to 2.2?

no, but gtkmm2 is a lot cleaner in many areas. if you don't have much
code written yet, it would probably be a good idea.

>> If I create a separate thread in MyCameraFramework, shall I pass to 
>> the thread a reference to this, so that then I can contol GUI objects 
>> with Dispatcher (or simila)?

either pass it that or face facts and make it global. in my code i
generally have a single "UI" object which is a singleton, and other
threads do stuff like:

	UI::instance().do_something(...);

but the truth is that this is just OOP syntactic candy for a global variable.

>> What I had in mind was the java multi-thread system, that seems a lot 
>> simpler than pthreads.

the java multithread system runs on pthreads (at least on linux). it
just removes most of the power and flexibility in favor of simplicity.

>> My problem can be easily described as a producer-consumer problem. The 
>> producer uses gtkmm to display its status and for some Adjustments; 
>> the consumer produces sounds according to the producer results.

i don't really understand the problems you think you are facing. for
reference, my current main project generally has 9 threads running,
only one of which does GUI work, but 5 of which need to change aspects
of the GUI display. i don't use the Dispatcher because i'm stuck with
gtkmm1.2 for now, but i use a very similar home-grown mechanism (it
might even have been part of the inspiration for the Dispatcher, but
i'm sure enough to claim that).

--p



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