Results of 1 - 10 of about 43 for pool (0.002 sec.)
- Pool::collect — Collect references to completed tasks | PHP 8.3 11229
- Pool::collect (PECL pthreads >= 2.0.0) Pool::collect — Collect references to completed tasks 説明 public function Pool::collect ( Callable $collector = ? ): int Allows the pool to collect references determined to be garbage by the optionall
... ollected or not. Only in rare cases should a custom collector need to be used. 戻り値 The number of remaining tasks in the pool to be collected. 変更履歴 バージョン 説明 PECL pthreads 3.0.0 An integer is now returned, and the collector parameter is n ... ow optional. 例 例1 A basic example of Pool::collect() <?php $pool = new Pool ( 4 ); for ( $i = 0 ; $i < 15 ; ++ $i ) { $pool -> submit (new class extends Threaded {} ... ); } while ( $pool -> collect ()); // blocks until all tasks have finished executing $pool -> shutdown (); 他のマニュアルの関連ページ Linux J ...
-
https://man.mtool.work/php/8.3/pool.collect.html
- The Pool class | PHP 8.3 11152
- The Pool class (PECL pthreads >= 2.0.0) はじめに A Pool is a container for, and controller of, an adjustable number of Workers. Pooling provides a higher level abstraction of the Worker functionality, including the management of references
... in the way required by pthreads. クラス概要 class Pool { /* プロパティ */ protected $ size ; protected $ class ; protected $ workers ; protected $ ctor ; protected $ last ; /* メ ... ask ): int public function submitTo ( int $worker , Threaded $task ): int } プロパティ size maximum number of Workers this Pool can use class the class of the Worker workers references to Workers ctor the arguments for constructor of new Workers last ... offset in workers of the last Worker used 目次 Pool::collect — Collect references to completed tasks Pool::__construct — Creates a new Pool of Workers Pool::resize — Resize t ...
-
https://man.mtool.work/php/8.3/class.pool.html
- Memory Management | PHP 8.3 11121
- Memory Management Yac keeps its data in two independent shared-memory pools, configured with yac.keys_memory_size and yac.values_memory_size . They fill up and free up in different ways, so it helps to know which pool a symptom belongs to b
... efore touching either knob. What Each Pool Holds The two pools store different halves of an entry. The key pool holds the keys: one slot per cached key, carrying the ... ) together with its hash, TTL, hit count and last-access time; the value is only referenced through a pointer to the value pool. The value pool holds the values: every stored value occupies one block of serialized bytes — the compressed form when the ... directly inside the slot, in the pointer that would otherwise reference a block. Such values occupy no space in the value pool at all; only their key does. As a rough sizing guide: the key pool holds around 8,000 keys per MB, so size yac.keys_memory ...
-
https://man.mtool.work/php/8.3/yac.memory-management.html
- Pool::__construct — Creates a new Pool of Workers | PHP 8.3 11013
- Pool::__construct (PECL pthreads >= 2.0.0) Pool::__construct — Creates a new Pool of Workers 説明 public function Pool::__construct ( int $size , string $class = ? , array $ctor = ? ) Construct a new pool of workers. Pools lazily create the
... reads will only be spawned when they are required to execute tasks. パラメータ size The maximum number of workers for this pool to create class The class for new Workers. If no class is given, then it defaults to the Worker class. ctor An array of ar ... guments to be passed to new workers' constructors 例 例1 Creating Pools <?php class MyWorker extends Worker { public function __construct ( Something $something ) { $this -> something = $someth ... ing ; } public function run () { /** ... **/ } } $pool = new Pool ( 8 , \MyWorker ::class, [new Something ()]); var_dump ( $pool ); ?> 上の例の出力は以下となります。 object(Pool ...
-
https://man.mtool.work/php/8.3/pool.construct.html
- Pool::submitTo — Submits a task to a specific worker for execution | PHP 8.3 10983
- Pool::submitTo (PECL pthreads >= 2.0.0) Pool::submitTo — Submits a task to a specific worker for execution 説明 public function Pool::submitTo ( int $worker , Threaded $task ): int Submit a task to the specified worker in the pool. The work
... ers are indexed from 0, and will only exist if the pool has needed to create them (since threads are lazily spawned). パラメータ worker The worker to stack the task onto, indexed ... ific worker <?php class Task extends Threaded { public function run () { var_dump ( Thread :: getCurrentThreadID ()); } } $pool = new Pool ( 2 ); $pool -> submit (new Task ()); for ( $i = 0 ; $i < 5 ; ++ $i ) { $pool -> submitTo ( 0 , new Task ()); / ... / stack all tasks onto the first worker } $pool -> submitTo ( 1 , new Task ()); // cannot stack the task onto the second worker due to it not existing yet $pool -> shutdo ...
-
https://man.mtool.work/php/8.3/pool.submitTo.html
- Pool::shutdown — Shutdown all workers | PHP 8.3 10952
- Pool::shutdown (PECL pthreads >= 2.0.0) Pool::shutdown — Shutdown all workers 説明 public function Pool::shutdown (): void Shuts down all of the workers in the pool. This will block until all submitted tasks have been executed. パラメータ こ
... の関数にはパラメータはありません。 戻り値 値を返しません。 例 例1 Shutting down a pool <?php class Task extends Threaded { public function run () { usleep ( 500000 ); } } $pool = new Pool ( 4 ); for ( $i = 0 ; ... $i < 10 ; ++ $i ) { $pool -> submit (new Task ()); } $pool -> shutdown (); // blocks until all submitted tasks have finished executing 他のマニュアル ...
-
https://man.mtool.work/php/8.3/pool.shutdown.html
- Pool::submit — Submits an object for execution | PHP 8.3 10134
- Pool::submit (PECL pthreads >= 2.0.0) Pool::submit — Submits an object for execution 説明 public function Pool::submit ( Threaded $task ): int Submit the task to the next Worker in the Pool パラメータ task The task for execution 戻り値 the
... ction __construct ( Something $something ) { $this -> something = $something ; } public function run () { /** ... **/ } } $pool = new Pool ( 8 , \MyWorker ::class, [new Something ()]); $pool -> submit (new MyWork ()); var_dump ( $pool ); ?> 上の例の出 ... 力は以下となります。 object(Pool)#1 (6) { ["size":protected]=> int(8) ["class":protected]=> string(8) "MyWorker" ["workers":protected]=> array(1) { [0]=> o ...
-
https://man.mtool.work/php/8.3/pool.submit.html
- Pool::resize — Resize the Pool | PHP 8.3 10103
- Pool::resize (PECL pthreads >= 2.0.0) Pool::resize — Resize the Pool 説明 public function Pool::resize ( int $size ): void Resize the Pool パラメータ size The maximum number of Workers this Pool can create 戻り値 値を返しません。 他のマニュ
...
-
https://man.mtool.work/php/8.3/pool.resize.html
- pthreads | PHP 8.3 8777
- pthreads はじめに pthreads はオブジェクト指向の API で、PHP でマルチスレッド処理を行うのに必要なすべてのツールを提供します。 PHP アプリケーションで、Thread や Worker そして Threaded を作ったり読み書きしたり実行したりできるようになります。 警
... 、あらゆるオブジェクトがスタックに積まれる前に実行されます。 そのため、オブジェクトで必要となるリソースの初期化に使えます。 Pool クラスを使って、 Threaded オブジェクトを分散させるワーカークラスのグループを作ることができます。 複数スレッドを扱う際に最も ... 簡単かつ効率的な方法です。 警告 Pool クラスは Threaded クラスを継承していません。 そして、Pool ベースのオブジェクトは通常の PHP オブジェクトです。 よって、その ... rk Collectable — The Collectable interface Collectable::isGarbage — Determine whether an object has been marked as garbage Pool — The Pool class Pool::collect — Collect references to completed tasks Pool::__construct — Creates a new Pool of Workers P ...
-
https://man.mtool.work/php/8.3/book.pthreads.html
- Collectable::isGarbage — Determine whether an object has been marked as garbage... 7543
- Collectable::isGarbage (PECL pthreads >= 2.0.8) Collectable::isGarbage — Determine whether an object has been marked as garbage 説明 public function Collectable::isGarbage (): true Can be called in Pool::collect() to determine if this objec
... 返します。 変更履歴 バージョン 説明 8.2.0 戻り値の型が、 true になりました。これより前のバージョンでは、 bool でした。 参考 Pool::collect() - Collect references to completed tasks 他のマニュアルの関連ページ Python multiprocessing ...
-
https://man.mtool.work/php/8.3/collectable.isgarbage.html