Scroll to navigation

Sympa::Process(3Sympa) sympa 6.2.70 Sympa::Process(3Sympa)

NAME

Sympa::Process - Process of Sympa

SYNOPSIS

  use Sympa::Process;
  my $process = Sympa::Process->instance;
  $process->init(pidname => 'sympa');
  $process->daemonize;
  $process->fork;

DESCRIPTION

Sympa::Process implements the class to handle process itself of Sympa software.

Signal handling

Once Sympa::Process is loaded, "SIGCHLD" signals are captured, and only defunct child processes invoked by fork() method are reaped.

Methods

Constructor. Creates a singleton instance of Sympa::Process object.

Returns:

A new Sympa::Process instance, or undef for failure.

Instance method. TBD.
Instance method. Daemonizes process itself. Process is given new process group, detached from TTY and given new process ID.

Parameters:

None.

Returns:

None.

Instance method. Forks process. Note that this method should be used instead of fork() in Perl core.

Parameter:

$tag
A string to determine new child process. By default the name of calling process.

Returns:

See "fork" in perlfunc.

DEPRECATED.
Instance method. Waits for any child process.

Parameters:

None.

Returns:

0. Returns "-1" on failure.

Updates process information in external data.

Parameters:

Syncs PIDs in local map %hash
Syncs child PIDs in PID file. If dead PID is found, notification will be sent to super-listmaster.

Returns:

None.

Instance method. Removes process ID from PID file. Then if the file is empty, it will be removed.
Instance method. Writes or adds process ID to PID file.

Parameters:

Initializes PID file. If the file remains, notification will be sent to super-listmaster.
Process ID to be written. By default PID of current process.
Instance method. TBD.

Attributes

Sympa::Process instance may have following attributes:

{children}
Hashref with child PIDs forked by fork() method as keys.
{detached}
True value is set if daemonize() method was called and the process has been detached from TTY.
{generation}
Generation of process. If fork() method succeeds, it will be increased by child process.

Utility functions

Evaluate subroutine $subref in $timeout seconds.

TBD.

Registers "SIGCHLD" handler. This function is usually called automatically during initialization.

HISTORY

Sympa::Tools::Daemon appeared on Sympa 6.2a.41.

Renamed Sympa::Process appeared on Sympa 6.2.12 and began to provide OO interface.

Sympa 6.2.13 introduced daemonize() method and {detached} attribute.

As of Sympa 6.2.14, "SIGCHLD" signal was captured and child processes were reaped immediately. reap_child() method (formerly reaper()) was deprecated.

2022-11-25 6.2.70