From d617f1c2300b1cc21a35628888414f92932e1757 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 12 Oct 2020 14:16:30 +0300 Subject: [PATCH] Fixed ODR for LTO with gcc5 (#2615) --- ...infer_async_request_thread_safe_default.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp b/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp index a0a0a89bfc2780..d7b2da1d01d599 100644 --- a/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp +++ b/inference-engine/src/plugin_api/cpp_interfaces/impl/ie_infer_async_request_thread_safe_default.hpp @@ -45,7 +45,9 @@ class AsyncInferRequestThreadSafeDefault : public AsyncInferRequestThreadSafeInt using Futures = std::vector>; using Promise = std::shared_ptr>; enum Stage_e : std::uint8_t { executor, task }; - struct DisableCallbackGuard{ + InferRequestInternal::Ptr _syncRequest; + + struct DisableCallbackGuard { explicit DisableCallbackGuard(AtomicCallback& callback) : _callbackRef(callback), _callback(callback.exchange(nullptr)) {} ~DisableCallbackGuard() { @@ -54,7 +56,12 @@ class AsyncInferRequestThreadSafeDefault : public AsyncInferRequestThreadSafeInt AtomicCallback& _callbackRef; IInferRequest::CompletionCallback _callback; }; - InferRequestInternal::Ptr _syncRequest; + + struct ImmediateStreamsExecutor : public InferenceEngine::ITaskExecutor { + explicit ImmediateStreamsExecutor(const IStreamsExecutor::Ptr& streamsExecutor) : _streamsExecutor{streamsExecutor} {} + void run(InferenceEngine::Task task) override {_streamsExecutor->Execute(std::move(task));} + IStreamsExecutor::Ptr _streamsExecutor; + }; public: /** @@ -78,14 +85,9 @@ class AsyncInferRequestThreadSafeDefault : public AsyncInferRequestThreadSafeInt _requestExecutor {taskExecutor}, _callbackExecutor {callbackExecutor}, _pipeline {{taskExecutor, [this] {_syncRequest->Infer();}}}, - _syncPipeline{{std::make_shared(), [this] {_syncRequest->Infer();}}} { + _syncPipeline {{std::make_shared(), [this] {_syncRequest->Infer();}}} { auto streamsExecutor = std::dynamic_pointer_cast(taskExecutor); if (streamsExecutor != nullptr) { - struct ImmediateStreamsExecutor : public InferenceEngine::ITaskExecutor { - explicit ImmediateStreamsExecutor(const IStreamsExecutor::Ptr& streamsExecutor) : _streamsExecutor{streamsExecutor} {} - void run(InferenceEngine::Task task) override {_streamsExecutor->Execute(std::move(task));} - IStreamsExecutor::Ptr _streamsExecutor; - }; _syncPipeline = {{std::make_shared(std::move(streamsExecutor)), [this] {_syncRequest->Infer();}}}; } }