mirror of
https://github.com/NVIDIA/cutlass.git
synced 2026-05-11 08:50:09 +00:00
ensure singleton::get thread safe construct instance (#658)
* ensure singleton::get thread safe construct instance * fix singleton return reference Co-authored-by: xuweiqi <xuweiqi117@gmail.com>
This commit is contained in:
@@ -42,10 +42,6 @@ namespace library {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::unique_ptr<Singleton> instance;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Singleton::Singleton() {
|
||||
|
||||
manifest.initialize();
|
||||
@@ -54,10 +50,8 @@ Singleton::Singleton() {
|
||||
}
|
||||
|
||||
Singleton const & Singleton::get() {
|
||||
if (!instance.get()) {
|
||||
instance.reset(new Singleton);
|
||||
}
|
||||
return *instance.get();
|
||||
static Singleton instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user