Thread priority or keeping a (wx)GUI responsive
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.
|All times are GMT. The time now is 11:46 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.