[gtkmm] Dispatcher/ Threading

Hi I am currently trying to understand threads and the Glib::Dispatcher

I have a program that loads plug-ins at runtime and I wanted to run the
each plugin's execute method in a separate thread. I have accomplished
this and I am able to update a progress bar in the main GUI thread.

However, I wish to be able to cancel the thread at anytime by closing
the progress dialogue I have tried experimenting with
throw Glib::Thread::Exit() exception, but the signal handler for the
progress bar is not within the thread.

Does anyone know of a way to view and cancel running threads ?

Also I am not sure that I understand the dispatcher class correctly.

Do I use dispatcher to simply raise signals from a thread? 

In the case of a progress bar I am not quite sure why the thread can not
access the set_progress method of a progress bar in the main GUI thread
directly to update it, without using signals. ?
Why raise the dispatcher signal from a thread ?

I have read the doxygen docs and the dispatcher example but I couldn't
find an overview of the threading problem and when / why dispatcher
needs to be used.

I am new to multithreading :)
Sorry if this is a duplicate.

Thanks for any help.


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