本文整理汇总了C++中Singleton::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Singleton::get方法的具体用法?C++ Singleton::get怎么用?C++ Singleton::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Singleton
的用法示例。
在下文中一共展示了Singleton::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setExecutor
void setExecutor(
std::shared_ptr<Exe> executor,
Singleton<std::weak_ptr<Exe>>& sExecutor,
Singleton<RWSpinLock, LockTag>& sExecutorLock) {
RWSpinLock::WriteHolder guard(sExecutorLock.get());
*sExecutor.get() = std::move(executor);
}
示例2: guard
std::shared_ptr<Exe> getExecutor(
Singleton<std::weak_ptr<Exe>>& sExecutor,
Singleton<std::shared_ptr<DefaultExe>>& sDefaultExecutor,
Singleton<RWSpinLock, LockTag>& sExecutorLock) {
std::shared_ptr<Exe> executor;
auto singleton = sExecutor.get();
auto lock = sExecutorLock.get();
{
RWSpinLock::ReadHolder guard(lock);
if ((executor = sExecutor->lock())) {
return executor;
}
}
RWSpinLock::WriteHolder guard(lock);
executor = singleton->lock();
if (!executor) {
executor = *sDefaultExecutor.get();
*singleton = executor;
}
return executor;
}
示例3:
FormatRegistry& FormatRegistry::instance()
{
static Singleton<FormatRegistry> sh;
return *sh.get();
}
示例4:
TestRunner& TestRunner::getDefault()
{
return *singleton.get();
}
示例5: getInstance
Houses* Houses::getInstance()
{
static Singleton<Houses> instance;
return instance.get();
}
示例6:
GarbageCollector& GarbageCollector::instance()
{
return *singleton.get();
}
示例7: instance
IOPlayer* IOPlayer::instance()
{
static Singleton<IOPlayer> instance;
return instance.get();
}
示例8: getInstance
ConnectionManager* ConnectionManager::getInstance()
{
static Singleton<ConnectionManager> instance;
return instance.get();
}