mirror-chatterino2/src/debug/AssertInGuiThread.hpp
2024-01-30 17:28:36 +01:00

22 lines
328 B
C++

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