This is an archive of the discontinued LLVM Phabricator instance.

Fix crash when libomp loaded/unloaded multiple times
ClosedPublic

Authored by jlpeyton on Jun 9 2016, 2:32 PM.

Details

Summary

The problem scenario is the following:
A dynamic library, libfoo.so, depends on libomp.so (it creates parallel region and calls some omp functions).
An application has a loop where it dynamically loads libfoo.so, calls the function from it, unloads libfoo.so.
After several loop iterations application crashes with the message about lack of resources
OMP: Error #34: System unable to allocate necessary resources for OMP thread:

The problem is that pthread_kill() was not followed by pthread_join() in case of terminated thread. This patch fixes this problem for both worker and monitor threads.

Diff Detail

Repository
rL LLVM

Event Timeline

jlpeyton updated this revision to Diff 60237.Jun 9 2016, 2:32 PM
jlpeyton retitled this revision from to Fix crash when libomp loaded/unloaded multiple times.
jlpeyton updated this object.
jlpeyton added reviewers: AndreyChurbanov, omalyshe.
jlpeyton set the repository for this revision to rL LLVM.
jlpeyton added a subscriber: openmp-commits.
AndreyChurbanov accepted this revision.Jun 11 2016, 2:39 AM
AndreyChurbanov edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 11 2016, 2:39 AM
This revision was automatically updated to reflect the committed changes.