mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-17 21:10:43 +00:00
winml/ was previously excluded from lintrunner config. This change includes the directory and adds the clang-format config file specific to winml/ that fits existing style. --------- Signed-off-by: Justin Chu <justinchu@microsoft.com>
19 lines
497 B
C++
19 lines
497 B
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
template <typename T, typename... TArgs>
|
|
std::shared_ptr<T> PheonixSingleton(TArgs&&... args) {
|
|
static std::weak_ptr<T> instance_;
|
|
static std::mutex lock_;
|
|
|
|
std::lock_guard<std::mutex> lock(lock_);
|
|
if (auto instance = instance_.lock()) {
|
|
return instance;
|
|
}
|
|
|
|
auto instance = std::make_shared<T>(std::forward<TArgs>(args)...);
|
|
instance_ = instance;
|
|
return instance;
|
|
}
|