From: Gautier write-only on 11 Mar 2010 20:50 > You're saying Feedback would check something to see if another task > wants to abort it, and raise an exception if the answer is "yes"? That's it (the exception being only internal to Compute, for reaching its end quickly; probably I'll use an 'exit when' instead). The feedback procedure would look like: http://unzip-ada.sourceforge.net/za_html/zip__ads.htm#218_8 > I'd use a protected object for that (as opposed to a global Boolean > user_abort as you seem to be suggesting). Thanks - indeed in a way or the other, there would a Boolean written (and only written) by the GUI action and read (and only read) by Feedback, randomly. Isn't the pragma Volatile sufficient in such a case ? > But I think this would work and might be better than the "abort" meat-axe approach. Thanks for the advice - indeed thinking further, it would be also useful for a "Stop" UI command, where the simulation is just interrupted, but the daemon would be kept alive for other simulations. Gautier
From: Gautier write-only on 11 Mar 2010 21:03
> However, I'd be surprised by the behavior if you abort the task but > Compute keeps using CPU for any length of time. Yes, that would be a bit counter-intuitive (since the call to Compute is part of the task). What happens is that the abort is in the main window's Destroy method, which occurs after its closing, so I guess it is just waiting at the abort statement. And if I understand well, a delay 0.0 in the main Compute loop would facilitate the aborting (I'll experiment it). Anyway, in the end I'll use the more deterministic way discussed elsewhere. Thanks Gautier |