Is it good to use a "throw exception" inside a parallel area?
What happens to other threads when one thread throws an exception?
the code:
#pragma omp parallel for for(int i = 0; i < n; i++) { if(arr[i] < 0) throw BadParameter("bad array value"); }
A throw executed inside a parallel region should cause execution to resume within the same parallel region, and it should be caught by the same thread that selected the exception.
Otherwise, it will apply to the unhandled exception.