I have a GUI application that's using pthreads to do some heavy background processing.
While the background processing is running the GUI is very unresponsive and I think that this is because it's being starved of CPU time by the background threads.
On Windows you can ::SetThreadPriority(hThread, THREAD_PRIORITY_BELOW_NORMAL) on the background threads and all is well.
However on Linux I'm using pthreads and I cannot find a good alternative.
I've already considered;
I'm convinced that this is quite a common pattern for GUI apps so what have I missed?
Marcus.
EDIT: Added ::setpriority to list of options (thanks ZalewaPL)
Setting nice value of the background threads to something higher may help.
Refer to this: Nice-Level for pthreads?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.