2017 © Pedro Peláez
 

library task

A PHP process forking and fork handling library.

image

troublete/task

A PHP process forking and fork handling library.

  • Thursday, October 19, 2017
  • by troublete
  • Repository
  • 1 Watchers
  • 0 Stars
  • 105 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

task

A PHP process forking and fork handling library., (*1)

Build Status, (*2)

Install

$ composer require troublete/task

Usage

<?php
require_once '/path/to/autoload.php';

use function Task\{forkTask, checkSuccess};

$pid = forkTask(function () {
    // do something that is only happening in the forked process
});

// continue work...

checkSuccess($pid); // to check if the process finished with great success

API

Functions

forkTask($taskClosure, $arguments = [], $signalHandler = null)

Function to fork off a child process. Returns the pid of the forked off process if successfull, throws an Exception if forking was not possible., (*3)

Arguments
Argument Type Description
$taskClosure callable Closure function that is only executed in the child process
$arguments array Arguments that are passed to the child process closure (optional)
$signalHandler callable Handler for process signals (optional)

getProcessStatus($processId = null)

Function that returns that status of a forked child by process id. If provided process id is null it'll return 0., (*4)

Arguments
Argument Type Description
$processId int Id of the process to be checked

checkSuccess($processId = null)

Function that returns based on the process status if a process already finished with great success. If the return value of this is false it does not necessarily mean that the process failed though. Since this is a non blocking process check. It is just not successfully finished at the point of the check., (*5)

Arguments
Argument Type Description
$processId int Id of the process to be checked

closeTask($processId = null)

Function to close a forked process. Returns true if successfull., (*6)

Arguments
Argument Type Description
$processId int Id of the process to be checked

License

GPL-2.0 © Willi Eßer, (*7)

The Versions

19/10 2017

dev-master

9999999-dev

A PHP process forking and fork handling library.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0
  • ext-pcntl *

 

The Development Requires

by Willi Eßer

19/10 2017

2.1.1

2.1.1.0

A PHP process forking and fork handling library.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0
  • ext-pcntl *

 

The Development Requires

by Willi Eßer

18/10 2017

2.1.0

2.1.0.0

A PHP process forking and fork handling library.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer

18/10 2017

2.0.0

2.0.0.0

A PHP process forking and fork handling library.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer

18/10 2017

1.0.1

1.0.1.0

A PHP process forking and fork handling library.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer

18/10 2017

1.0.0

1.0.0.0

A PHP process forking and fork handling library.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer