mirror of
https://github.com/cculianu/Fulcrum.git
synced 2026-08-16 13:01:07 +02:00
33 lines
601 B
C++
33 lines
601 B
C++
#include "Mgr.h"
|
|
#include "Util.h"
|
|
#include <QTimer>
|
|
#include <QThread>
|
|
#include <memory>
|
|
|
|
Mgr::Mgr(QObject *parent)
|
|
: QObject(parent)
|
|
{
|
|
}
|
|
|
|
Mgr::~Mgr()
|
|
{
|
|
}
|
|
|
|
|
|
// unsafe
|
|
auto Mgr::stats() const -> Stats
|
|
{
|
|
return Stats();
|
|
}
|
|
|
|
// thread-safe
|
|
Mgr::Stats Mgr::statsSafe() const
|
|
{
|
|
Stats ret;
|
|
try {
|
|
ret = Util::CallOnObject/*WithTimeout*/<Stats>(/*1000,*/ this, &Mgr::stats); // NB: this will actually call the subclass's virtual function because C++ is awesome.
|
|
} catch (const std::exception & e) {
|
|
Debug() << "Safe stats get failed: " << e.what();
|
|
}
|
|
return ret;
|
|
}
|