Bernard Parisse on Sat, 16 Sep 2006 18:06:04 +0200

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

Re: PARI_stack_limit

>But you run exactly one thread at once ?
currently, yes, but this could change in the future, when giac
will be thread-safe. If pari is not thread-safe, I will use a
mutex lock.

>Could you write a stand-alone test case ? It would help.

That would be too long, it's faster that you compile giac with
run gdb on icas and make a breakpoint in, line 426.
Then for example
(gdb) r 'pari("sin",x)'
will stop just before flisexpr is called
The call comes (f 1) from the _pari function, and you will see
at line 556 that I replace PARI_stack_limit by 0

> Well being thread-safe is another issue (See Configure
> --enable-tls). It seems to me that we could make the function
> pari_init_stackcheck public, and require you call it a the
> start of each threads. We should also provide an init_opts
> flag to deactivate it.

But there are global variables inside PARI, right? How can you make
PARI thread-safe if there are global variables remaining?
For giac, I'm removing 1 by 1 all these global variables, I group
them in a structure, and I add a pointer to this structure for
every function that used these global variables, that's a very
long task, I'm about halfway of it (it began around 2 years ago...).