From d57bd8450ed96196f11f7e7f024a75a182750632 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Thu, 27 Dec 2018 18:34:51 +0100 Subject: Thread safe redirect for controller applications --- cpp/test/ios/controller/Bundle/ControllerI.mm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'cpp/test/ios/controller') diff --git a/cpp/test/ios/controller/Bundle/ControllerI.mm b/cpp/test/ios/controller/Bundle/ControllerI.mm index 8bcbbb84697..46cf7739c9f 100644 --- a/cpp/test/ios/controller/Bundle/ControllerI.mm +++ b/cpp/test/ios/controller/Bundle/ControllerI.mm @@ -109,6 +109,8 @@ namespace Ice::CommunicatorPtr _communicator; }; + + Test::StreamHelper streamRedirect; } ControllerHelperI::ControllerHelperI(id controller, const string& dll, const StringSeq& args) : @@ -197,6 +199,11 @@ ControllerHelperI::run() return; } + if(_dll.find("client") != string::npos || _dll.find("collocated") != string::npos) + { + streamRedirect.setControllerHelper(this); + } + CREATE_HELPER_ENTRY_POINT createHelper = (CREATE_HELPER_ENTRY_POINT)sym; char** argv = new char*[_args.size() + 1]; for(unsigned int i = 0; i < _args.size(); ++i) @@ -206,8 +213,6 @@ ControllerHelperI::run() argv[_args.size()] = 0; try { - Test::StreamHelper streamHelper(this, - _dll.find("client") != string::npos || _dll.find("collocated") != string::npos); IceInternal::UniquePtr helper(createHelper()); helper->setControllerHelper(this); helper->run(static_cast(_args.size()), argv); @@ -225,6 +230,11 @@ ControllerHelperI::run() } delete[] argv; + if(_dll.find("client") != string::npos || _dll.find("collocated") != string::npos) + { + streamRedirect.setControllerHelper(0); + } + CFBundleUnloadExecutable(handle); CFRelease(handle); } -- cgit v1.2.3