]> git.vpit.fr Git - perl/modules/Thread-Cleanup.git/blob - README
Update VPIT::TestHelpers to 15e8aee3
[perl/modules/Thread-Cleanup.git] / README
1 NAME
2     Thread::Cleanup - Hook thread destruction.
3
4 VERSION
5     Version 0.07
6
7 SYNOPSIS
8         use Thread::Cleanup;
9
10         use threads;
11
12         Thread::Cleanup::register {
13          my $tid = threads->tid();
14          warn "Thread $tid finished\n";
15         };
16
17 DESCRIPTION
18     This module allows you to hook thread destruction without fiddling with
19     the internals of threads.
20
21     It acts globally on all the threads that may spawn anywhere in your
22     program, with the exception of the main thread.
23
24     The hooks registered with this module will also be called when
25     pseudo-forks (i.e. processes spawn on Windows for the "fork" emulation)
26     terminate.
27
28 FUNCTIONS
29   "register"
30         register { ... };
31         &register($coderef);
32
33     Specify that the given block or code reference $coderef will have to be
34     called (in void context, without arguments) every time a thread or a
35     pseudo-fork terminates. More precisely :
36
37     *   For joined threads, it will be called when "join" succeeds, after
38         any "END" block local to the spawn thread ;
39
40     *   For detached threads, it will be called if and only if the thread
41         terminates before the main thread, and the hook will then fire at
42         global "END" time ;
43
44     *   For pseudo-forks, it will be called when "waitpid" succeeds, after
45         any local or global "END" block ;
46
47     *   It will never trigger for the destruction of the main thread.
48
49 EXPORT
50     None.
51
52 DEPENDENCIES
53     perl 5.8.
54
55     A C compiler. This module may happen to build with a C++ compiler as
56     well, but don't rely on it, as no guarantee is made in this regard.
57
58     threads 1.07.
59
60     XSLoader.
61
62 AUTHOR
63     Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
64
65 BUGS
66     Please report any bugs or feature requests to "bug-thread-cleanup at
67     rt.cpan.org", or through the web interface at
68     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Thread-Cleanup>. I will
69     be notified, and then you'll automatically be notified of progress on
70     your bug as I make changes.
71
72 SUPPORT
73     You can find documentation for this module with the perldoc command.
74
75         perldoc Thread::Cleanup
76
77 ACKNOWLEDGEMENTS
78     Inspired by a question from TonyC on #p5p.
79
80 COPYRIGHT & LICENSE
81     Copyright 2009,2010,2013,2014 Vincent Pit, all rights reserved.
82
83     This program is free software; you can redistribute it and/or modify it
84     under the same terms as Perl itself.
85