#include "GuiInvoker.h" #include #pragma data_seg("Shared") int volatile g_bRegistered_GuiInvoker = false; #pragma data_seg() #pragma comment(linker,"/section:Shared,RWS") GuiInvoker::GuiInvoker(QObject* parent) : QThread(parent) { /* if(!g_bRegistered_GuiInvoker) { qRegisterMetaType("GuiInvoker_Func"); g_bRegistered_GuiInvoker = true; } */ qRegisterMetaType("GuiInvoker_Func"); connect(this, &GuiInvoker::sigInvoke, this, &GuiInvoker::OnInvoke); this->start(); } GuiInvoker::~GuiInvoker() { this->wait(); disconnect(this, &GuiInvoker::sigInvoke, this, &GuiInvoker::OnInvoke); } void GuiInvoker::start() { QThread::start(); } void GuiInvoker::wait() { QThread::wait(); } void GuiInvoker::run() { return; } void GuiInvoker::Invoke(GuiInvoker_Func pFunc, void* pParams, void* pOwner) { emit sigInvoke(pFunc, pParams, pOwner); } void GuiInvoker::OnInvoke(GuiInvoker_Func pFunc, void* pParams, void* pOwner) { if (nullptr != pFunc) { pFunc(pParams, pOwner); } }