Thread priority or keeping a (wx)GUI responsive

N

NoelByron

I need to do some intense calculations in my application. Those are
done by a third party Python library and consume 100% CPU time for some
seconds. The computations take place in their own thread to keep my GUI
responsive (wxPython in my case).

Everything works fine on a dual core machine. On a single CPU machine,
the computation slows down the whole GUI (better, the whole machine).
The ideal solution in my case would be to give the computation thread a
very low priority. But I fear that is not possible?

Moving the computations to a different process look quite complex since
the result is a large Python data structure. And I fear it would not
solve the problem since I can only influence the priority of a
subprocess on the windows plattform (I refer to the documentation of
the subprocess module).

Another possible solution is to include some idle times
(time.sleep(0.05) or wxYield() or even better with python yields?) in
the algorithm of the computations. Ugly, since I would have to
manipulate a third party library. Could sys.setcheckinterval() help?

Do I miss something? Any help, tips or advice would be appreciated.

Best regards,
Noel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top