http://qs321.pair.com?node_id=603546


in reply to Window + fork + Math::Pari = pain

fork doesn't really have anything to do with it. It's about threading. Keep in mind that fork creates a new *thread* in Windows, not a new *process*. The problem can be triggered more directly using:

perl -MMath::Pari -Mthreads -e "threads->create(sub{})->join();"

It appears that Math::Pari is not thread-safe.

Replies are listed 'Best First'.
Re^2: Window + fork + Crypt::Random = pain
by bsb (Priest) on Mar 07, 2007 at 03:52 UTC
    That also segfaults in linux.
Re^2: Window + fork + Crypt::Random = pain
by bsb (Priest) on Mar 07, 2007 at 02:49 UTC
    I'm using the Math::Pari ppm but it's build process seems to only use the unix source PariBuild.pm
    sub download_pari { my ($srcfile, $force) = (shift, shift); my $host = 'megrez.math.u-bordeaux.fr'; my $dir = '/pub/pari/unix/'; my($ftp, $ua, $base_url); ...
    There is a windows build at ftp://megrez.math.u-bordeaux.fr/pub/pari/windows/ which may avoid the problem although I haven't yet tried to use it.

    Thanks for your reply

      If the module isn't thread safe, a special windows build wouldn't avoid the problem.
        Some C libraries can be compiled to be threadsafe but are not by default, eg. SQLite. (I admit that's probably not the case here)