How to give highest priority to events generated from main thread than those generated from secondar
Posted
by martjno
on Stack Overflow
See other posts from Stack Overflow
or by martjno
Published on 2010-03-31T13:11:46Z
Indexed on
2010/03/31
13:13 UTC
Read the original article
Hit count: 373
I have a c++ application written in wxWidgets, which has a main thread (GUI) and a working thread (calculations).
The working thread executes commands requested by the main thread and communicates the result to the main thread posting an event after every step of the processing.
The problem is that when the working thread is sending many events consecutively, the gui requests made by the user (i.e. interrupt the processing clicking a button) won't be processed by the event handler until the working thread has finished.
This is actually happening on OSX, on Windows it works perfectly. I've tried to wxThread::SetPriority and wxThread::Yield but nothing changes. It is working if I put wxThread::Sleep in the working thread, but this slows down very much the processing.
© Stack Overflow or respective owner