2 Thread::Cleanup - Hook thread destruction.
12 Thread::Cleanup::register {
13 my $tid = threads->tid();
14 warn "Thread $tid finished\n";
18 This module allows you to hook thread destruction without fiddling with
19 the internals of threads.
21 It acts globally on all the threads that may spawn anywhere in your
22 program, with the exception of the main thread.
26 Specify that the "BLOCK" will have to be called (in void context,
27 without arguments) every time a thread finishes is job. More precisely,
29 * it will always be called before the join for joined threads ;
31 * it will be called for detached threads only if they terminate before
32 the main thread, and the hook will then fire at "END" time ;
34 * it won't trigger for the the destruction of the main thread.
47 Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
50 Please report any bugs or feature requests to "bug-thread-cleanup at
51 rt.cpan.org", or through the web interface at
52 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Thread-Cleanup>. I will
53 be notified, and then you'll automatically be notified of progress on
54 your bug as I make changes.
57 You can find documentation for this module with the perldoc command.
59 perldoc Thread::Cleanup
62 Inspired by a question from TonyC on #p5p.
65 Copyright 2009 Vincent Pit, all rights reserved.
67 This program is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.