syphilis has asked for the wisdom of the Perl Monks concerning the following question:
When perl is built with the mcf toolchain I get:use warnings; use strict; use threads; use Math::MPFR qw(:mpfr); die "threads version is too old" if $threads::VERSION < 1.71; die "mpfr library was built without TLS support" unless Rmpfr_buildopt_tls_p(); # Default precision is 53. # First, change it to 101 # Then change it to 201 (inside a separate thread) Rmpfr_set_default_prec(101); my $thr1 = threads->create( sub { Rmpfr_set_default_prec(201); return Rmpfr_get_default_prec(); } ); my $res = $thr1->join(); if($res == 201) { print "ok 1\n" } else { print "\$res: $res (expected 201) not ok 1\n" } if(Rmpfr_get_default_prec() == 101) { print "ok 2\n" } else { print "\$res: $res\nprec: ", Rmpfr_get_default_prec(), "\nNOT o +k 2\n"}
When perl is built with the pthreads toolchain (or built on Linux) I get:>perl tls.pl $res: 53 (expected 201) not ok 1 ok 2
The only difference lies in the compiler that built perl.>perl tls.pl ok 1 ok 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [Win32] differing threads behaviour
by syphilis (Archbishop) on Apr 09, 2023 at 01:21 UTC | |
by syphilis (Archbishop) on Apr 11, 2023 at 12:20 UTC | |
by syphilis (Archbishop) on Apr 12, 2023 at 01:31 UTC |