Here goes nothing
[p5sagit/Exception-Guaranteed.git] / t / __SelfDestruct.pm
1 package __SelfDestruct;
2
3 use warnings;
4 use strict;
5
6 sub spawn_n_kill (&) {
7   {
8     my $x = bless [ $_[1], ($INC{'threads.pm'} ? threads->tid : 0) ];
9     undef $x;
10   }
11   1;
12 }
13
14 sub DESTROY {
15   $_[0]->[0]->() unless ($_[0]->[1] and threads->tid != $_[0]->[1]);
16 }
17
18 1;