I need to know in the context of which thread my function is running, is it main GUI thread or some worker thread.
I can\'t use a simple solution to store QThread pointe
If you have Qt in the lib you can ask for the thread of the application object. The application object is alway living in the main gui thread.
void fooWorker() { const bool isGuiThread = QThread::currentThread() == QCoreApplication::instance()->thread(); }