| 522 | } |
| 523 | |
| 524 | std::shared_ptr<streamfx::updater> streamfx::updater::instance() |
| 525 | { |
| 526 | static std::weak_ptr<streamfx::updater> _instance; |
| 527 | static std::mutex _lock; |
| 528 | |
| 529 | std::lock_guard<std::mutex> lock(_lock); |
| 530 | if (_instance.expired()) { |
| 531 | auto ptr = std::make_shared<streamfx::updater>(); |
| 532 | _instance = ptr; |
| 533 | return ptr; |
| 534 | } else { |
| 535 | return _instance.lock(); |
| 536 | } |
| 537 | } |