forked from kriswallsmith/spork
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d41293b
commit 01e69dc
Showing
2 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Spork, an OpenSky project. | ||
* | ||
* (c) OpenSky Project Inc | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Spork; | ||
|
||
use Spork\Batch\BatchJob; | ||
use Spork\Batch\Strategy\StrategyInterface; | ||
|
||
class Factory | ||
{ | ||
/** | ||
* Creates a new batch job instance. | ||
* | ||
* @param ProcessManager $manager The process manager | ||
* @param null $data Data for the batch job | ||
* @param StrategyInterface $strategy The strategy | ||
* | ||
* @return BatchJob A new batch job instance | ||
*/ | ||
public function createBatchJob(ProcessManager $manager, $data = null, StrategyInterface $strategy = null) | ||
{ | ||
return new BatchJob($manager, $data, $strategy); | ||
} | ||
|
||
/** | ||
* Creates a new shared memory instance. | ||
* | ||
* @param integer $pid The child process id or null if this is the child | ||
* @param integer $signal The signal to send after writing to shared memory | ||
* | ||
* @return SharedMemory A new shared memory instance | ||
*/ | ||
public function createSharedMemory($pid = null, $signal = null) | ||
{ | ||
return new SharedMemory($pid, $signal); | ||
} | ||
|
||
/** | ||
* Creates a new fork instance. | ||
* | ||
* @param int $pid Process id | ||
* @param SharedMemory $shm Shared memory | ||
* @param bool $debug Debug mode | ||
* | ||
* @return Fork A new fork instance | ||
*/ | ||
public function createFork($pid, SharedMemory $shm, $debug = false) | ||
{ | ||
return new Fork($pid, $shm, $debug); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters