Chatterino
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AssertInGuiThread.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QCoreApplication>
4 #include <QThread>
5 #include <cassert>
6 
7 namespace chatterino {
8 
9 static bool isGuiThread()
10 {
11  return QCoreApplication::instance()->thread() == QThread::currentThread();
12 }
13 
14 static void assertInGuiThread()
15 {
16 #ifdef _DEBUG
17  assert(isGuiThread());
18 #endif
19 }
20 
21 } // namespace chatterino
Definition: Application.cpp:48