Our software consists of a Graphical User Interface in C++/Qt. The user interface controls several heavy computational algorithms in a separate library which uses C++/OpenMP for parallelization. In this library we cannot use Qt.
To keep our GUI responsive we use function pointers which call QApplication::processEvents();. This of course leads to spaghetti code. We would like to separate the GUI from the computation library, so that the function calls do not block the GUI any longer. What is the clean and prefered way to do this?
If you don’t need to interrupt the openMP library calls, then I would go for a simple multi-threading approach: one thread deals with the GUI, another with the computational library. Naturally you cannot use openMP for this (this would not fare well with the computational openMP library), but must use other multi-threading methods. C++11 now comes with its own direct support of threads, so that’s what I would do.
EDIT: read Anthony Williams “C++ concurrency in action”