refs #540 Add the ability to capture the current call stack, and use it in singleShot.

This commit is contained in:
Mathew Sutcliffe
2015-12-05 23:30:28 +00:00
parent 886f9937ce
commit 1282fc4c14
5 changed files with 131 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
#include "blackmiscexport.h"
#include "variant.h"
#include "stacktrace.h"
#include <QThread>
#include <QMutex>
#include <QTimer>
@@ -53,8 +54,10 @@ namespace BlackMisc
auto *timer = new QTimer;
timer->setSingleShot(true);
timer->moveToThread(target);
auto trace = getStackTrace();
QObject::connect(timer, &QTimer::timeout, [ = ]()
{
static_cast<void>(trace);
task();
timer->deleteLater();
});