1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
4 #########################
6 # change 'tests => 1' to 'tests => last_test_to_print';
10 BEGIN { plan tests => 16 };
14 ok(1); # If we made it this far, we're ok.
16 #########################
18 # Insert your test code below, the Test module is use()ed here so read
19 # its man page ( perldoc Test ) for help writing this test script.
22 skip('The ignores are here to keep test numbers correct','The ignores are here to keep test numbers correct');
24 #test passing of simple argument
25 my $thread = threads->create(sub { ok('bar',$_[0]) },"bar");
27 skip('Ignore','Ignore');
29 #test passing of complex argument
31 $thread = threads->create(sub { ok('bar',$_[0]->[0]->{foo})},[{foo => 'bar'}]);
34 skip('Ignore','Ignore');
36 #test execuion of normal sub
37 sub bar { ok(1,shift()) }
38 threads->create(\&bar,1)->join();
39 skip('Ignore','Ignore');
42 ok("1", "$Config::threads");
44 #test trying to detach thread
46 my $thread1 = threads->create(sub {ok(1);});
49 skip('Ignore','Ignore');
52 #create nested threads
53 unless($^O eq 'MSWin32') {
54 my $thread3 = threads->create(sub { threads->create(sub {})})->join();
57 skip('thread trees are unsafe under win32','thread trees are unsafe under win32');
59 skip('Ignore','Ignore');
63 unless($^O eq 'MSWin32') {
65 push @threads, threads->create(sub { for(1..100000) { my $i } threads->create(sub { sleep 2})->join() });
67 foreach my $thread (@threads) {
73 my $self = threads->self();
76 skip('Ignore','Ignore');
78 my $self = threads->self();
81 skip('Ignore','Ignore');
83 #check support for threads->self() in main thread
84 ok(0,threads->self->tid());