1use strict; 2use warnings; 3 4use Test2::Util qw/CAN_THREAD/; 5use Test2::IPC; 6use Test2::API qw/context/; 7 8sub plan { 9 my $ctx = context(); 10 $ctx->plan(@_); 11 $ctx->release; 12} 13 14sub ok($;$) { 15 my ($bool, $name) = @_; 16 my $ctx = context(); 17 $ctx->ok($bool, $name); 18 $ctx->release; 19} 20 21plan(0, skip_all => 'System does not have threads') unless CAN_THREAD(); 22 23plan(6); 24 25require threads; 26threads->import; 27 28for (1 .. 3) { 29 threads->create(sub { 30 ok(1, "test 1 in thread " . threads->tid()); 31 ok(1, "test 2 in thread " . threads->tid()); 32 }); 33} 34 351; 36