提交 3643d9de 编写于 作者: D dev

本提交解决tbWatchDog定时器在非UI线程创建问题。

上级 bf969f67
......@@ -2,6 +2,7 @@
#include <QDebug>
#include <QTimerEvent>
#include <QVector>
#include <QSharedPointer>
static bool g_tb_break = false;
#ifdef WIN32
#include <windows.h>
......@@ -31,7 +32,7 @@ void my_handler(int s){
}
#endif
static tbWatchDog g_tb_watch_dog_;
QSharedPointer<tbWatchDog> g_tb_watch_dog_;
tbWatchDog::tbWatchDog(QObject *parent)
:QObject(parent)
......@@ -116,6 +117,8 @@ QVector<TASKBUS::tagMemoryInfo> tbWatchDog::get_info()
tbWatchDog & tb_watch_dog()
{
return g_tb_watch_dog_;
if (!g_tb_watch_dog_)
g_tb_watch_dog_ = QSharedPointer<tbWatchDog>( new tbWatchDog());
return *g_tb_watch_dog_;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册