Re: New multi-threaded example program in the gtkmm tutorial



Hi Kjell, thank you very much for take your time on prepare that example and the detailed explanation on the documentation.
It will help may users to be able to use threads properly.

Cheers
Carlos

De: Kjell Ahlstedt <kjell ahlstedt bredband net>
Para: gtkmm-list <gtkmm-list gnome org>
Enviado: MiƩrcoles 7 de agosto de 2013 10:29
Asunto: New multi-threaded example program in the gtkmm tutorial

The last few weeks we have seen an extremely verbose thread of conversation on gtkmm-list (How to update both the Console and the GTKMM gui window after running other functions). I have not read all the countless posts in that thread of conversation, but it made me aware that the gtkmm tutorial contains a chapter on multi-threaded programs, https://developer.gnome.org/gtkmm-tutorial/stable/chapter-multi-threaded-programs.html.en, but no example program. Now I have added an example program at https://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/multithread. I also added a short explanation in the tutorial. Since it may take some time before that explanation will be easily available on the web, I show it here:

This is an example program with two threads, one GUI thread, like in all gtkmm programs, and one worker thread.
The worker thread is created when you press the Start work button. It is deleted when the work is finished,
when you press the Stop work button, or when you press the Quit button.

A Glib::Dispatcher is used for sending notifications from the worker thread to the GUI thread.
The ExampleWorker class contains data which is accessed by both threads. This data is protected
by a Glib::Threads::Mutex. Only the GUI thread updates the GUI.

If you find bugs in the example program, I'd like to know. I have strived to make it thread-safe.


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




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