Re: Background Threading Option



On Tue, 3 Oct 2017 15:58:37 +0530
Deepak Chiradoni <deepakachiradoni gmail com> 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


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