https://bugs.kde.org/show_bug.cgi?id=448769

--- Comment #3 from Evan Teran <ete...@alum.rit.edu> ---
Right. So addressing this "right" is suprisingly complex. Basically the issue
is that the code for doing arbitrary precision math has no "cancellation
points". The conventional solution to this kind of thing is to do the work in a
background thread, and have that thread periodically check "did the user
cancel"... But the library we use (GMP) just does the work, start to finish. It
doesn't ask the caller "should I continue?" at any point during a long
calculation. 

Killing a thread mid-process is considered so dangerous, that many OSes don't
even provide clean APIs to do it... 

The other solution, which GMP also doesn't offer, is to have the work done in
small bits you can call repeatedly until complete, allowing the caller an
oportunity to run the event loop themselves (and/or just stop calling the "do
some work" function if the user wishes to cancel). One can imagine the math
being done in a virtual machine of sorts where the caller can run as many or as
few instructions towards solving the problem at a time as they please.

Either way, Neither of these are really easily options for us.

So what's the solution? Well, probably to literally have the work done in a
seperate process which CAN be killed via a signal and communicate the results
with a pipe. It will be complicated to do this nicely, but it's doable and
would fully address this issue of long running calculations freezing the UI.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to