I am using a code that's written by somebody else, where he used OpenMP for Multi-Threading.

So I found out, that you can't use OpenMP threads and QThreads at the same time. That means I have to possible ways to make my GUI work:

1. Write my own BackgroundWorker, so that my GUI still works, when executing this function after a button click.
2. Rewrite my function, so that it is done in QThreads.

My problem with rewriting to QThreads is, that the code was not written very well:

It only has one class, with a lot of variables and functions, where the variables are changed inside the functions and across different sections.
The threading does something like this.
Qt Code:
  1. #pragma omp parallel sections
  2. {
  3. #pragma omp section
  4. { ....
  5. }
  6. #pragma omp section
  7. { ....
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 

So my question is:
What is easier, writing a BackgroundWorker or rewriting the function?
Second, could you roughly outline a solution?

Thanks very much
schludy