POSIX::AtFork(3pm)

POSIX::AtFork3pm

Hook registrations at fork(2)

Usage

  # POSIX interface:
  use POSIX::AtFork qw(:all);
  
  pthread_atfork(\&prepare, \&parent, \&child);
  # or per-hook interfaces:
  POSIX::AtFork->add_to_prepare(\&prepare);
  POSIX::AtFork->add_to_parent(\&parent);
  POSIX::AtFork->add_to_child(\&child);
  # registered callbacks can be removed
  POSIX::AtFork->delete_from_prepare(\&prepare);
  POSIX::AtFork->delete_from_parent( \&parent);
  POSIX::AtFork->delete_from_child(  \&child);

Overview

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

Interface

pthread_atfork(\&prepare, \&parent, \&child)

Registeres hooks called before fork() (&prepare) and after (&parent for the parent, &child for the child).

All callbacks are called with the current opname, namely "fork", "system", "backtick", and etc.

This exportable function is an interface to pthread_atfork(3).

POSIX::AtFork->add_to_prepare(\&hook)

The same as "pthread_atfork(\&hook, undef, undef)".

POSIX::AtFork->add_to_parent(\&hook)

The same as "pthread_atfork(undef, \&hook, undef)".

POSIX::Atfork->add_to_child(\&hook)

The same as "pthread_atfork(undef, undef, \&hook)".

POSIX::AtFork->delete_from_prepare(\&hook)

Deletes &hook from the "prepare" hook list.

POSIX::AtFork->delete_from_parent(\&hook)

Deletes &hook from the "parent" hook list.

POSIX::AtFork->delete_from_child(\&hook)

Deletes &hook from the "child" hook list.

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

Authors

Fuji, Goro (gfx)

Shulyakovskiy, Nikolay (nikolas)

From libposix-atfork-perl 0.04-2+b5 in Debian 13 (Trixie). Parsed by carta from the page's man source.