On 2017-01-13 at 23:40 GMT+01:00 Bill wrote:
On Fri, Jan 13, 2017 at 11:00:28PM +0100, Loïc Grenié wrote:
> Package: pari
> Version: dd75740be
> Severity: normal
>
>      Hi Karim and Bill,
>
>      I think you probably understood what I will say. With pthread,
>
> parfor(n=10,20,addprimes(nextprime(10^n)))
>
>     crashes in the free(old) off addp().
>
>   addprimes() should probably be either disabled or protected with
>   pthread.

We need a way for (MPI or posix) threads to inherit primetab from the
master thread.

     Right now posix threads inherit primetab (that's the reason why it
  crashes in the first place). A new field primetab in mt_queue could
  allow to copy the master thread primetab to the children (for posix).
  For MPI a send_request_GEN(PMPI_primetab, primetab, i);
  could work (with the obvious modifications to mt/mpi.c). In that
  case addprime() would be local to the child thread (in both cases).

       Loïc