summaryrefslogtreecommitdiff
path: root/ext/Thread/die2.t
blob: 4bc611a321400ac858776380a7666d28b060930c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
BEGIN {
    eval { require Config; import Config };
    if ($@) {
	print "1..0 # Skip: no Config\n";
	exit(0);
    }
    if ($Config{extensions} !~ /\bThread\b/) {
	print "1..0 # Skip: no use5005threads\n";
	exit(0);
    }
}

use Thread 'async';

$t = async {
    sleep 1;
    print "here\n";
    die "success if preceded by 'thread died...'";
    print "shouldn't get here\n";
};

print "joining...\n";
@r = eval { $t->join; };
if ($@) {
    print "thread died with message: $@";
} else {
    print "thread failed to die successfully\n";
}