OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Make custom ThreadLocal implementation copyable (#28900)
Arseniy Obolenskiyeb44f8d0a5c1
diff --git a/src/inference/dev_api/openvino/runtime/threading/thread_local.hpp b/src/inference/dev_api/openvino/runtime/threading/thread_local.hppindex 9a3edee83fc..32f2a5b732b 100644--- a/src/inference/dev_api/openvino/runtime/threading/thread_local.hpp+++ b/src/inference/dev_api/openvino/runtime/threading/thread_local.hpp@@ -59,8 +59,16 @@ struct ThreadLocal {_create = std::move(other._create);return *this;}- ThreadLocal(const ThreadLocal&) = delete;- ThreadLocal& operator=(const ThreadLocal&&) = delete;+ ThreadLocal(const ThreadLocal& other) : _create(other._create) {+ std::lock_guard<std::mutex> lock{other._mutex};+ _map = other._map;+ }+ ThreadLocal& operator=(const ThreadLocal& other) {+ std::lock_guard<std::mutex> lock{other._mutex};+ _map = other._map;+ _create = other._create;+ return *this;+ }explicit ThreadLocal(const Create& create_) : _create{create_} {}T& local() {