PHP - Fonction Pool :: construct ()

La fonction Pool :: _ construct () peut créer un nouveau pool de travailleurs.

Syntaxe

public Pool Pool::__construct( integer $size [, string $class [, array $ctor ]] )

La fonction Pool :: _ construct () peut construire un nouveau pool de workers. Les pools créent paresseusement leurs threads, ce qui signifie que de nouveaux threads ne peuvent être créés que lorsqu'ils sont requis pour exécuter des tâches.

La fonction Pool :: _ construct () peut renvoyer un nouveau pool.

Exemple

<?php
   class MyWorker extends Worker {
      public function __construct(Something $something) {
         $this->something = $something;
      }
      public function run() {
         /** ... **/
      }
   }
   $pool = new Pool(8, \MyWorker::class, [new Something()]);
   var_dump($pool);
?>