Bill Allombert on Sat, 01 Jul 2023 14:50:16 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: How to interrupt a MT calculation?


On Sat, Jul 01, 2023 at 01:30:35PM +0200, Loïc Grenié wrote:
> On Sat 1 Jul 2023 aT 12:39, Bill Allombert wrote:
> 
> > On Sat, Jul 01, 2023 at 01:04:49AM +0200, Jean-Luc Arnaud wrote:
> > > So, it seems like error does not work the same way on Linux (and probably
> > > Windows) versus Mac OS, or is there a bug in the 2.16.0 Alpha version?
> >
> > No this is a limitation of pthread on macos:
> > <
> > https://stackoverflow.com/questions/43109438/macos-macoss-pthread-pthread-cancel-asynchronous-not-working
> > >
> >
> 
>      Definitely not the recommended way, but could a SEGV help?
> 
> install("getpid","l")
> extern(Str("kill -SEGV ", getpid()))

That would not help: PARI will catch the SEGV and then call pthread_cancel to cancel the threads.
No, your best bet is to make new_chunk or set_avma a cancellation point, but this slows down GP.

Cheers,
Bill