Parallel::Forker::Process(3p)

NAME
Parallel::Forker::Process - Single parallel fork process object

SYNOPSIS
   $obj->run;
   $obj->poll;
   $obj->kill(<"SIGNAL">);
   $obj->kill_tree(<"SIGNAL">);

DESCRIPTION
Manage a single process under the control of Parallel::Forker.

Processes are created by calling a Parallel::Forker object's schedule method, and retrieved by various methods in that class.

Processes transition over 6 states. They begin in idle state, and are transitioned by the user into ready state. As their dependencies complete, Parallel::Forker transitions them to the runable state. As the Parallel::Forker object's "max_proc" limit permits, they transition to the running state, and get executed. On completion, they transition to the done state. If a process depends on another process, and that other process fails, the dependant process transitions to the parerr (parent error) state, and is never run.

METHODS

forkref
    Return the parent Parallel::Forker object this process belongs to.

is_done
    Returns true if the process is in the done state.

is_idle
    Returns true if the process is in the idle state.

is_parerr
    Returns true if the process is in the parent error state.

is_ready
    Returns true if the process is in the ready state.

is_reapable
    Returns true if the process is reapable (->reap may be called on it).

is_runable
    Returns true if the process is in the runable state.

is_running
    Returns true if the process is in the running state.

kill(<signal>)
    Send the specified signal to the process if it is running. If no signal is specified, send a SIGKILL (9).

kill_tree(<signal>)
    Send the specified signal to the process (and its subchildren) if it is running. If no signal is specified, send a SIGKILL (9).

kill_tree_all(<signal>)
    Send a signal to this child (and its subchildren) if it is running. If no signal is specified, send a SIGKILL (9).

label
    Return the label of the process, if any, else undef.

name
    Return the name of the process.

pid Return the process ID if this job is running, else undef.

poll
    Check the process for activity, invoking callbacks if needed. Generally Parallel::Forker's object method "poll()" is used instead.

ready
    Mark this process as being ready for execution when all "run_after"'s are ready and CPU resources permit. When that occurs, run will be called on the process automatically.

reap
    When the process has no other processes waiting for it, and the process is is_done or is_parerr, remove the data structures for it. This reclaims memory for when a large number of processes are being created, run, and destroyed.

run Unconditionally move the process to the "running" state and start it.

run_after
    Add a new (or list of) processes that must be completed before this process can be runnable. You may pass a process object (from schedule), a process name, or a process label. You may use "|" or "&" in a string to run this process after ANY processes exit, or after ALL exit (the default.) ! in front of a process name indicates to run if that process fails with bad exit status. ^ in front of a process indicates to run if that process succeeds OR fails.

state
    Returns the name of the current state, 'idle', 'ready', 'runable', 'running', 'done' or 'parerr'. For forward compatibility, use the is_idle etc. methods instead of comparing this accessor's value to a constant string.

status
    Return the exit status of this process if it has completed. The exit status will only be correct if a CHLD signal handler is installed, otherwise it may be undef.

status_ok
    Return true if the exit status of this process was zero. Return false if not ok, or if the status has not been determined, or if the status was undef.

DISTRIBUTION
The latest version is available from CPAN and from <https://www.veripool.org/parallel-forker>.

Copyright 2002-2019 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.

AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>

SEE ALSO
Parallel::Forker