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