On 12/04/2017 07:37 PM, Hartmut Kaiser wrote:
> There are several ways how to integrate Qt with HPX and let it run its main
> loop. 
> 
> There is this example which explicitly drives Qt using HPX's
> main_pool_executor:
> https://github.com/STEllAR-GROUP/hpx/tree/master/examples/qt.

Wow, thanks a lot for your quick help and reply. But the example is
confusing me a bit.

The main problem when using a parallel system and Qt is that most member
functions of widgets must not be called from a thread other than the
main thread (GUI-thread). So when a thread other than the main thread
wants to trigger some GUI change, it has to communicate with the GUI
thread and the GUI thread then does the GUI change.

This principle is ignored in the example: In the example [1], an HPX
thread calls widget::add_label which in turn calls QListWidget::addItem.
I think this should not happen, even when protected with a mutex-lock.

I modified the code to be correct in my understanding: The widget has
now two threadsafe interface functions: threadsafe_add_label and
threadsafe_run_finished, both of which do not interact with GUI objects.
They might be called from any thread. They in turn schedule the
execution of corresponding functions within the GUI thread.

Would you agree? I am not a GUI expert, so I'm not sure about my solution.
I created a pull request [2]. Feel free to accept or reject...

best regards,
Andreas


[1]
https://github.com/STEllAR-GROUP/hpx/blob/2ec00bc39b5d384aeda7cdb58a893680a057e2d2/examples/qt/widget.cpp#L53

[2]
https://github.com/STEllAR-GROUP/hpx/pull/3051

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to