Allows people to override the resetting by using srand() in CLONE.
p4raw-id: //depot/perl@19289
use ExtUtils::testlib;
use strict;
-BEGIN { $| = 1; print "1..24\n" };
+BEGIN { $| = 1; print "1..25\n" };
use threads;
use threads::shared;
ok($th);
ok($th->join());
}
+{
+ # there is a little chance this test case will falsly fail
+ # since it tests rand
+ my %rand : shared;
+ rand(10);
+ threads->new( sub { $rand{int(rand(10000000000))}++ } ) foreach 1..25;
+ $_->join foreach threads->list;
+# use Data::Dumper qw(Dumper);
+# print Dumper(\%rand);
+ #$val = rand();
+ ok((keys %rand == 25), "Check that rand works after a new thread");
+}
+
+
PerlIO_flush((PerlIO*)NULL);
PERL_THREAD_SETSPECIFIC(self_key,thread);
-
+ SAVEBOOL(PL_srand_called); /* Save this so it becomes the correct
+ value */
+ PL_srand_called = FALSE; /* Set it to false so we can detect
+ if it gets set during the clone */
#ifdef WIN32
thread->interp = perl_clone(aTHX, CLONEf_KEEP_PTR_TABLE | CLONEf_CLONE_HOST);
*/
{
dTHXa(thread->interp);
+
/* Here we remove END blocks since they should only run
in the thread they are created
*/