Is it possible to destroy the threads created by OpenMP? When the program starts, there is only the one thread. After the parallelized section multiple threads remain since there is a thread pool. Is there any way to destroy this pool after the parallel section is run?
I ask because I'm using OpenMP in a dynamic library, and the library handle cannot be closed while the threads are running (the program will segfault).
Thanks
More explanation: I'm putting all parallelization code into modules (shared libraries). I then load the module and pass it a class derived from an abstract base class. The module then 'runs' that class in parallel. This way, I can use no parallelization, OpenMP, MPI, or anything else and can change the parallel scheme at run time or even on the fly. But OpenMP doesn't destroy the threads, and when it comes time to manually dlclose the library, it will segfault since the resources are destroyed from underneath the thread (I believe). Letting the program finish without closing the library is probably ok for now, but wanting to manually close the library may still come up in the future (think changing scheme on the fly). Hope this makes sense :) Thanks