mirror-chatterino2/src/debug/AssertInGuiThread.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
328 B
C++
Raw Normal View History

#pragma once
#include <QCoreApplication>
#include <QThread>
#include <cassert>
2019-10-07 15:46:08 +02:00
namespace chatterino {
2019-08-01 13:30:58 +02:00
static bool isGuiThread()
{
return QCoreApplication::instance()->thread() == QThread::currentThread();
}
static void assertInGuiThread()
{
#ifdef _DEBUG
2019-08-01 13:30:58 +02:00
assert(isGuiThread());
#endif
}
2019-10-07 15:46:08 +02:00
} // namespace chatterino