1POSIX::AtFork(3)      User Contributed Perl Documentation     POSIX::AtFork(3)
2
3
4

NAME

6       POSIX::AtFork - Hook registrations at fork(2)
7

SYNOPSIS

9         # POSIX interface:
10         use POSIX::AtFork qw(:all);
11
12         pthread_atfork(\&prepare, \&parent, \&child);
13
14         # or per-hook interfaces:
15         POSIX::AtFork->add_to_prepare(\&prepare);
16         POSIX::AtFork->add_to_parent(\&parent);
17         POSIX::AtFork->add_to_child(\&child);
18
19         # registered callbacks can be removed
20         POSIX::AtFork->delete_from_prepare(\&prepare);
21         POSIX::AtFork->delete_from_parent( \&parent);
22         POSIX::AtFork->delete_from_child(  \&child);
23

DESCRIPTION

25       This module is an interface to pthread_atfork(3), which registeres
26       handlers called before and after fork(2).
27

INTERFACE

29   pthread_atfork(\&prepare, \&parent, \&child)
30       Registeres hooks called before "fork()" (&prepare) and after (&parent
31       for the parent, &child for the child).
32
33       All callbacks are called with the current opname, namely "fork",
34       "system", "backtick", and etc.
35
36       This exportable function is an interface to pthread_atfork(3).
37
38   POSIX::AtFork->add_to_prepare(\&hook)
39       The same as "pthread_atfork(\&hook, undef, undef)".
40
41   POSIX::AtFork->add_to_parent(\&hook)
42       The same as "pthread_atfork(undef, \&hook, undef)".
43
44   POSIX::Atfork->add_to_child(\&hook)
45       The same as "pthread_atfork(undef, undef, \&hook)".
46
47   POSIX::AtFork->delete_from_prepare(\&hook)
48       Deletes &hook from the "prepare" hook list.
49
50   POSIX::AtFork->delete_from_parent(\&hook)
51       Deletes &hook from the "parent" hook list.
52
53   POSIX::AtFork->delete_from_child(\&hook)
54       Deletes &hook from the "child" hook list.
55

SEE ALSO

57       pthread_atfork(3)
58
59       fork(2)
60

AUTHORS

62       Fuji, Goro (gfx)
63
64       Shulyakovskiy, Nikolay (nikolas)
65
67       Copyright (C) 2010 by Fuji, Goro gfx <gfuji@cpan.org>.
68
69       Copyright (C) 2020 by Shulyakovskiy, Nikolay nikolas
70       <nikolas@cpan.org>.
71
72       This library is free software; you can redistribute it and/or modify it
73       under the same terms as Perl itself,
74
75
76
77perl v5.34.0                      2022-01-21                  POSIX::AtFork(3)
Impressum