« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 79 for Worker (0.001 sec.)
GearmanWorker::wait — Wait for activity from one of the job servers | PHP 8.3 10576
GearmanWorker::wait (PECL gearman >= 0.6.0) GearmanWorker::wait — Wait for activity from one of the job servers 説明 public function GearmanWorker::wait (): bool Causes the worker to wait for activity from one of the Gearman job servers whe ... メータ この関数にはパラメータはありません。 戻り値 成功した場合に true を、失敗した場合に false を返します。 例 例1 Running worker in non-blocking mode <?php echo "Starting\n" ; # Create our worker object $worker = new GearmanWorker (); # Make the worke ... r non-blocking $worker -> addOptions ( GEARMAN_WORKER_NON_BLOCKING ); # Add the default server (localhost, port 4730) $worker -> addServer (); # ... Add our reverse function $worker -> addFunction ( 'reverse' , 'reverse_fn' ); # Try to grab a job while (@ $worker -> work () || $worker -> returnCode () = ...
https://man.mtool.work/php/8.3/gearmanworker.wait.html
Worker::collect — Collect references to completed tasks | PHP 8.3 10576
Worker::collect (PECL pthreads >= 3.0.0) Worker::collect — Collect references to completed tasks 説明 public function Worker::collect ( Callable $collector = ? ): int Allows the worker to collect references determined to be garbage by the o ... ollected or not. Only in rare cases should a custom collector need to be used. 戻り値 The number of remaining tasks on the worker's stack to be collected. 例 例1 A basic example of Worker::collect() <?php $worker = new Worker (); echo "There are curren ... tly { $worker -> collect ()} tasks on the stack to be collected\n" ; for ( $i = 0 ; $i < 15 ; ++ $i ) { $worker -> stack (new class exte ... nds Threaded {}); } echo "There are { $worker -> collect ()} tasks remaining on the stack to be collected\n" ; $worker -> start (); while ( $worker -> collect ()); // b ...
https://man.mtool.work/php/8.3/worker.collect.html
Worker::isShutdown — State Detection | PHP 8.3 10494
Worker::isShutdown (PECL pthreads >= 2.0.0) Worker::isShutdown — State Detection 説明 public function Worker::isShutdown (): bool Whether the worker has been shutdown or not. パラメータ この関数にはパラメータはありません。 戻り値 Returns wh ... ether the worker has been shutdown or not. 例 例1 Detect the state of a worker <?php $worker = new Worker (); $worker -> start (); var_dump ... ( $worker -> isShutdown ()); $worker -> shutdown (); var_dump ( $worker -> isShutdown ()); 上の例の出力は以下となります。 bool(false ...
https://man.mtool.work/php/8.3/worker.isshutdown.html
Worker::stack — Stacking work | PHP 8.3 10151
Worker::stack (PECL pthreads >= 2.0.0) Worker::stack — Stacking work 説明 public function Worker::stack ( Threaded &$work ): int Appends the new work to the stack of the referenced worker. パラメータ work A Threaded object to be executed by ... the worker. 戻り値 The new size of the stack. 例 例1 Stacking a task for execution onto a worker <?php $worker = new Worker (); $work ... = new class extends Threaded {}; var_dump ( $worker -> stack ( $work )); 上の例の出力は以下となります。 int(1) 他のマニュアルの関連ページ Python library Docker docker stack l ...
https://man.mtool.work/php/8.3/worker.stack.html
Worker::getStacked — Gets the remaining stack size | PHP 8.3 10068
Worker::getStacked (PECL pthreads >= 2.0.0) Worker::getStacked — Gets the remaining stack size 説明 public function Worker::getStacked (): int Returns the number of tasks left on the stack パラメータ この関数にはパラメータはありません。 戻り ... 値 Returns the number of tasks currently waiting to be executed by the worker 例 例1 A basic example of Worker::getStacked <?php $worker = new Worker (); for ( $i = 0 ; $i < 5 ; ++ $i ) { $worker -> s ... tack (new class extends Threaded {}); } echo "There are { $worker -> getStacked ()} stacked tasks\n" ; 上の例の出力は以下となります。 There are 5 stacked tasks 他のマニュアルの関連ページ P ...
https://man.mtool.work/php/8.3/worker.getstacked.html
Worker クラス | PHP 8.3 9986
Worker クラス (PECL pthreads >= 2.0.0) はじめに ワーカースレッドには永続コンテキストがあり、たいていの場合はスレッドに対して使えます。 ワーカーを開始させると run メソッドを実行しますが、以下のいずれかの条件を満たすまでスレッドは終了しません ... 。 Worker がスコープから外れる (どこからも参照されなくなる) プログラマーが shutdown を呼ぶ スクリプトが終了する つまり、プログラマー ... は実行中のコンテキストを再利用できるということです。 オブジェクトを Worker のスタックに置くと、そのオブジェクトの run メソッドを Worker が実行します。 クラス概要 class Worker extends Thread impleme ... ::isStarted (): bool public function Thread::join (): bool public function Thread::start ( int $options = ? ): bool } 目次 Worker::collect — Collect references to completed tasks Worker::getStacked — Gets the remaining stack size Worker::isShutdown — S ...
https://man.mtool.work/php/8.3/class.worker.html
Pool::submitTo — Submits a task to a specific worker for execution | PHP 8.3 9725
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 worker ... e 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 from 0 . task The task for execution. 戻り値 The identifier of the worker that ... accepted the task. 例 例1 Submitting tasks to a specific worker <?php class Task extends Threaded { public function run () { var_dump ( Thread :: getCurrentThreadID ()); } } $pool = new ... t (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 - ...
https://man.mtool.work/php/8.3/pool.submitTo.html
定義済み定数 | PHP 8.3 9134
定義済み定数 以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。 SWOOLE_VERSION ( string ) Swoole version. SWOOLE_VERSION_ID ( int ) Swoole ve ... ver must be created before client. SWOOLE_ERROR_SERVER_TOO_MANY_SOCKET ( int ) Server too many socket. SWOOLE_ERROR_SERVER_WORKER_TERMINATED ( int ) Server worker terminated. SWOOLE_ERROR_SERVER_INVALID_LISTEN_PORT ( int ) Server invalid listen port. S ... er too many listen port. SWOOLE_ERROR_SERVER_PIPE_BUFFER_FULL ( int ) Server pipe buffer full. SWOOLE_ERROR_SERVER_NO_IDLE_WORKER ( int ) Server no idle worker. SWOOLE_ERROR_SERVER_ONLY_START_ONE ( int ) Server only start one. SWOOLE_ERROR_SERVER_SEND_ ... ( int ) Server invalid callback. SWOOLE_ERROR_SERVER_UNRELATED_THREAD ( int ) Server unrelated thread. SWOOLE_ERROR_SERVER_WORKER_EXIT_TIMEOUT ( int ) Server worker exit timeout. SWOOLE_ERROR_SERVER_WORKER_ABNORMAL_PIPE_DATA ( int ) Server worker abnor ...
https://man.mtool.work/php/8.3/swoole.constants.html
Worker::shutdown — Shutdown the worker | PHP 8.3 8901
Worker::shutdown (PECL pthreads >= 2.0.0) Worker::shutdown — Shutdown the worker 説明 public function Worker::shutdown (): bool Shuts down the worker after executing all of the stacked tasks. パラメータ この関数にはパラメータはありません。 ... 戻り値 成功した場合に true を、失敗した場合に false を返します。 例 例1 Shutdown the referenced worker <?php $my = new Worker (); $my -> start (); /* stack/execute tasks */ var_dump ( $my -> shutdown ()); 上の例の出力は以下と ...
https://man.mtool.work/php/8.3/worker.shutdown.html
GearmanWorker::addFunction — Register and add callback function | PHP 8.3 8626
GearmanWorker::addFunction (PECL gearman >= 0.5.0) GearmanWorker::addFunction — Register and add callback function 説明 public function GearmanWorker::addFunction ( string $function_name , callable $function , mixed $context = null , int $t ... egistered function name is submitted context A reference to arbitrary application context data that can be modified by the worker function timeout An interval of time in seconds 戻り値 成功した場合に true を、失敗した場合に false を返します。 例 例1 Si ... mple worker making use of extra application context data <?php # get a gearman worker $worker = new GearmanWorker (); # add the defaul ... t server (localhost) $worker -> addServer (); # define a variable to hold application data $count = 0 ; # add the "reverse" function $worker -> addFunc ...
https://man.mtool.work/php/8.3/gearmanworker.addfunction.html
PREV 1 2 3 4 5 6 7 8 NEXT