1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
5 unless ($Config{useithreads}) {
6 print "1..0 # SKIP your perl does not support ithreads\n";
10 if ($INC{'Devel/Cover.pm'}) {
11 print "1..0 # SKIP Devel::Cover does not work with threads yet\n";
21 use DBIx::Class::_Util 'sigwarn_silencer';
25 plan skip_all => 'DBIC does not actively support threads before perl 5.8.5'
28 plan skip_all => 'Potential problems on Win32 Perl < 5.14 and Variable::Magic - investigation pending'
29 if $^O eq 'MSWin32' && "$]" < 5.014 && DBICTest::RunMode->is_plain;
31 # README: If you set the env var to a number greater than 10,
32 # we will use that many children
33 my $num_children = $ENV{DBICTEST_THREAD_STRESS} || 1;
34 if($num_children !~ /^[0-9]+$/ || $num_children < 10) {
38 my $schema = DBICTest->init_schema(no_deploy => 1);
39 isa_ok ($schema, 'DBICTest::Schema');
44 local $SIG{__WARN__} = sigwarn_silencer( qr/Thread creation failed/i );
46 for (1.. $num_children) {
47 push @threads, threads->create(sub {
48 my $rsrc = $schema->source('Artist');
50 isa_ok ($rsrc->schema, 'DBICTest::Schema');
51 my $s2 = $rsrc->schema->clone;
53 sleep 1; # without this many tasty crashes
55 skip "EAGAIN encountered, your system is likely bogged down: skipping rest of test", 1
56 if $! == Errno::EAGAIN();
58 die "Unable to start thread: $!";
63 ok(1, "past spawning");
65 $_->join for @threads;
66 ok(1, "past joining");