diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-06-23 18:19:42 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-06-23 18:19:42 -0400 |
commit | 4b5aff6c604161e890234befc34a43e66b96019c (patch) | |
tree | 562127cc38e630882de1021103c7631b7eb606ad /cpp/test/ios/controller/Bundle/ControllerI.mm | |
parent | Fix for ICE-8141 - increased the hold time and reduced the sequence size (diff) | |
download | ice-4b5aff6c604161e890234befc34a43e66b96019c.tar.bz2 ice-4b5aff6c604161e890234befc34a43e66b96019c.tar.xz ice-4b5aff6c604161e890234befc34a43e66b96019c.zip |
Fix for ICE-8140: the controller occasionally does not find dllTestShutdown
Diffstat (limited to 'cpp/test/ios/controller/Bundle/ControllerI.mm')
-rw-r--r-- | cpp/test/ios/controller/Bundle/ControllerI.mm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cpp/test/ios/controller/Bundle/ControllerI.mm b/cpp/test/ios/controller/Bundle/ControllerI.mm index 309311b946d..538534a0d4f 100644 --- a/cpp/test/ios/controller/Bundle/ControllerI.mm +++ b/cpp/test/ios/controller/Bundle/ControllerI.mm @@ -193,10 +193,16 @@ MainHelperI::run() return; } - // The following call is necessary to prevent random failures from CFBundleGetFunctionPointerForName - dlsym(_handle, "dllTestShutdown"); + // + // The first CFBundleGetFunction... does not always succeed, so we make up to 3 attempts + // + void* sym = 0; + int attempts = 0; + while((sym = CFBundleGetFunctionPointerForName(_handle, CFSTR("dllTestShutdown"))) == 0 && attempts < 3) + { + attempts++; + } - void* sym = CFBundleGetFunctionPointerForName(_handle, CFSTR("dllTestShutdown")); if(sym == 0) { NSString* err = [NSString stringWithFormat:@"Could not get function pointer dllTestShutdown from bundle %@", @@ -205,6 +211,13 @@ MainHelperI::run() completed(EXIT_FAILURE); return; } + /* + else + { + print([[NSString stringWithFormat:@"*** found dllTestShutdown after %d failed attempt(s)", attempts] UTF8String]); + } + */ + _dllTestShutdown = (SHUTDOWN_ENTRY_POINT)sym; sym = CFBundleGetFunctionPointerForName(_handle, CFSTR("dllMain")); |