example) where they take to long. Should this work or would I
On May 15, 6:57 pm, "Grayson, Daniel R." <
d...@math.uiuc.edu> wrote:
> This is a problem with the way exceptions are handled in Macaulay2:
> when an alarm sounds, our interrupt handler routine sets a global
> variable and expects the code to check the value periodically to see
> whether it's time to stop a computation. But the factorial function
> is implemented in a third-party subroutine library, gmp or mpir, which doesn't check
> Macaulay2's stopping variable.
>
> It occurs to me now that if we were to switch to compiling the interpreter
> in C++ instead of C we should be able to switch to using C++ exceptions
> to handle that. (When we started the project, we shied
> away from using C++ exceptions.)
>
> On the other hand, we are developing the ability to run Macaulay2 simultaneously
> in separate threads. When an alarm sounds, which thread should stop? I don't
> know.
>
> On May 15, 2012, at 5:50 AM, Andrew Chan wrote:
>
>
>
>
>
>
>
> > I am trying to get M2 to skip certain computations if they take too
> > long, and judging from previous discussions on here the solution is to
> > use 'alarm' in conjunction with 'try'.
>
> > I do not understand how to implement this properly. As an example, I
> > tried using the example from this thread: