Progress on closures
This commit is contained in:
parent
39d1084a3f
commit
f88f453578
13 changed files with 427 additions and 144 deletions
26
tests/gearman_client.php
Normal file
26
tests/gearman_client.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
require 'ncc';
|
||||
|
||||
use Tamer\Objects\JobResults;
|
||||
use Tamer\Objects\Task;
|
||||
|
||||
import('net.nosial.tamerlib', 'latest');
|
||||
|
||||
$client = new \Tamer\Protocols\GearmanClient();
|
||||
$client->addServer();
|
||||
|
||||
$client->doBackground(new Task('sleep', '5'));
|
||||
|
||||
|
||||
$client->addTask(new Task('sleep', '5', function(JobResults $job) {
|
||||
echo "Task {$job->getId()} completed with data: {$job->getData()} \n";
|
||||
}));
|
||||
|
||||
|
||||
$client->addTask(new Task('sleep', '5', function(JobResults $job) {
|
||||
echo "Task {$job->getId()} completed with data: {$job->getData()} \n";
|
||||
}));
|
||||
|
||||
|
||||
$client->run();
|
Loading…
Add table
Add a link
Reference in a new issue