summaryrefslogtreecommitdiffstats
path: root/openmp
diff options
context:
space:
mode:
authorAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-29 17:18:20 +0000
committerAndrey Churbanov <Andrey.Churbanov@intel.com>2015-01-29 17:18:20 +0000
commit9bf5328f97deeabc4496888dfc91dc9d68e14dde (patch)
tree1f5652d7fba46a8d72d337a8ae3d6fa83d4917ac /openmp
parent6d768fcc18e86a7a6ca39ea492fec04be37aab82 (diff)
downloadbcm5719-llvm-9bf5328f97deeabc4496888dfc91dc9d68e14dde.tar.gz
bcm5719-llvm-9bf5328f97deeabc4496888dfc91dc9d68e14dde.zip
Pin the libiomp5.dll for the lifetime of application, Windows-specific
llvm-svn: 227469
Diffstat (limited to 'openmp')
-rw-r--r--openmp/runtime/src/z_Windows_NT_util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/openmp/runtime/src/z_Windows_NT_util.c b/openmp/runtime/src/z_Windows_NT_util.c
index b581d4639e0..62fd0e47c4c 100644
--- a/openmp/runtime/src/z_Windows_NT_util.c
+++ b/openmp/runtime/src/z_Windows_NT_util.c
@@ -835,6 +835,21 @@ __kmp_runtime_initialize( void )
return;
};
+#if GUIDEDLL_EXPORTS
+ /* Pin dynamic library for the lifetime of application */
+ {
+ // First, turn off error message boxes
+ UINT err_mode = SetErrorMode (SEM_FAILCRITICALERRORS);
+ HMODULE h;
+ BOOL ret = GetModuleHandleEx( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
+ |GET_MODULE_HANDLE_EX_FLAG_PIN,
+ (LPCTSTR)&__kmp_serial_initialize, &h);
+ KMP_DEBUG_ASSERT2(h && ret, "OpenMP RTL cannot find itself loaded");
+ SetErrorMode (err_mode); // Restore error mode
+ KA_TRACE( 10, ("__kmp_runtime_initialize: dynamic library pinned\n") );
+ }
+#endif
+
InitializeCriticalSection( & __kmp_win32_section );
#if USE_ITT_BUILD
__kmp_itt_system_object_created( & __kmp_win32_section, "Critical Section" );
OpenPOWER on IntegriCloud