I have a simple program that consists of two threads:
- Main GUI thread operated by Qt
QApplication::exec
- TCP network thread operated by
boost::asio::io_service
TCP events, such as connecting or receiving data cause changes in GUI. Most often, those are setText
on QLabel and hiding various widgets. Currently, I am executing those actions in TCP client thread, which seems quite unsafe.
How to post properly an event to Qt Main thread? I am looking for Qt variant of boost::asio::io_service::strand::post
, which posts event to boost::asio::io_service
event loop.