diff --git a/composer.json b/composer.json index 3a03f7b..f87ed1c 100755 --- a/composer.json +++ b/composer.json @@ -35,7 +35,10 @@ "autoload": { "psr-4": { "Icicle\\Concurrent\\": "src" - } + }, + "files": [ + "src/Worker/functions.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/examples/worker-pool.php b/examples/worker-pool.php index c0cdfac..6d236e2 100755 --- a/examples/worker-pool.php +++ b/examples/worker-pool.php @@ -2,23 +2,21 @@ enqueue(new HelloTask())), - new Coroutine\Coroutine($pool->enqueue(new HelloTask())), - new Coroutine\Coroutine($pool->enqueue(new HelloTask())), + new Coroutine\Coroutine(Worker\enqueue(new HelloTask())), + new Coroutine\Coroutine(Worker\enqueue(new HelloTask())), + new Coroutine\Coroutine(Worker\enqueue(new HelloTask())), ])); var_dump($returnValues); - yield $pool->shutdown(); + yield Worker\pool()->shutdown(); })->done(); Loop\run(); diff --git a/src/Worker/functions.php b/src/Worker/functions.php new file mode 100644 index 0000000..2a792b2 --- /dev/null +++ b/src/Worker/functions.php @@ -0,0 +1,40 @@ +enqueue($task); + } +}