Bill Allombert on Sat, 01 Jul 2023 21:55:10 +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 02:50:15PM +0200, Bill Allombert wrote: > 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. Jean-Luc, you can try the following patch, it should fix this, but it will slowdown GP a bit. (you will need to do 'make clean') Cheers, Bill
diff --git a/src/headers/parisys.h b/src/headers/parisys.h index ee80d5b7c..0aa92a584 100644 --- a/src/headers/parisys.h +++ b/src/headers/parisys.h @@ -61,5 +61,6 @@ BEGINEXTERN ENDEXTERN #define CHECK_CTRLC if (win32ctrlc) dowin32ctrlc(); #else -#define CHECK_CTRLC +void pthread_testcancel(void); +#define CHECK_CTRLC pthread_testcancel(); #endif