Background Threading Option

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Background Threading Option

Deepak Chiradoni
Hello,

Is there a Background threading option in GTKMM as in VB script. As I am doing CAN communication using GUI (GTKMM 3.0). The GUI has to receive and send packets continuously in the interval of 20 milliseconds. While receiving packets the task I defined for widgets has to update in parallel. The thread has to work according to the following Link as in VB.


Please help regarding this.

Regards
Deepak, India.

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: Background Threading Option

Chris Vine-3
On Tue, 3 Oct 2017 15:58:37 +0530
Deepak Chiradoni <[hidden email]> wrote:

> Hello,
>
> Is there a Background threading option in GTKMM as in VB script. As I
> am doing CAN communication using GUI (GTKMM 3.0). The GUI has to
> receive and send packets continuously in the interval of 20
> milliseconds. While receiving packets the task I defined for widgets
> has to update in parallel. The thread has to work according to the
> following Link as in VB.
>
> https://www.codeproject.com/Articles/99143/BackgroundWorker-Class-Sample-for-Beginners

You can just start your worker thread using std::async, std::thread or
Glib::Threads::Thread, and on completion the worker thread can post its
continuation to the glib main loop using
Glib::SignalIdle::connect_once(): see
https://developer.gnome.org/glibmm/2.52/classGlib_1_1SignalIdle.html

For something more formalized you could use
TaskManager::make_task_packaged_compose() from c++-gtk-utils:
http://cxx-gtk-utils.sourceforge.net/2.2/classCgu_1_1Thread_1_1TaskManager.html#aea4d2ce3d963f207f2c23813ae9e8c2a

Chris
_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list