mirror-chatterino2/lib/appbase/debug/AssertInGuiThread.hpp
2019-09-08 22:27:57 +02:00

22 lines
331 B
C++

#pragma once
#include <QCoreApplication>
#include <QThread>
#include <cassert>
namespace AB_NAMESPACE {
static bool isGuiThread()
{
return QCoreApplication::instance()->thread() == QThread::currentThread();
}
static void assertInGuiThread()
{
#ifdef _DEBUG
assert(isGuiThread());
#endif
}
} // namespace AB_NAMESPACE