Class that represents the execution of a single task within a parallelized frame.
category |
DocBlox |
---|---|
package |
Parallel |
author |
Mike van Riel mike.vanriel@naenius.com |
license |
http://www.opensource.org/licenses/mit-license.php MIT |
link |
http://docblox-project.org |
__construct(callback $task, mixed[] $arguments = array())
callback
The task to invoke upon execution.
mixed[]
The arguments to provide to the task.
getArguments() : mixed[]
getTask() : callback
getReturnCode() : int
This method may return -1 if no return code is available yet.
int
setReturnCode(int $return_code) : void
Recommended is to use the same codes as are used with {@link http://www.gnu.org/software/bash/manual/html_node/Exit-Status.html exit codes}.
In short: 0 means that the task succeeded and a any other positive value indicates an error condition.
throw |
if the code is not a number or negative |
---|
int
Recommended to be a positive number
getError() : string
string
setError(string $error) : void
string
The error message.
getResult() : null|mixed
null|mixed
setResult(mixed $result) : void
mixed
The value that is returned by the task; can be anything.
execute() : \void.
\void.
setTask(callback $task) : void
throws |
if the given argument is not a callback. |
---|---|
see | \DocBlox_Parallel_Worker::__construct() \DocBlox_Parallel_Worker::execute() |
callback
The task to execute when the execute method is invoked.
task : callback
var |
the task to execute for this worker |
---|
callback
arguments : mixed[]
var |
A list of argument to pass to the task |
---|
mixed[]
return_code : int
var |
The return code to tell the parent process how it went |
---|
int
result : mixed
var |
The result of the given task |
---|
mixed
error : string
var |
The error message, if an error occurred |
---|
string