« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 3 of about 3 for MyEventSignal (0.001 sec.)
Constructing signal events | PHP 8.3 11068
Constructing signal events Event can also watch for POSIX-style signals. To construct a handler for a signal, use Event::__construct() constructor with Event::SIGNAL flag, or Event::signal() factory method. 例1 Handling SIGTERM signal <?php ... -color=auto examp $ kill -TERM 3976 At the first terminal window you should catch the following: Caught signal 15 */ class MyEventSignal { private $base , $ev ; public function __construct ( $base ) { $this -> base = $base ; $this -> ev = Event :: signal ( $b ... ntSighandler ( $no , $c ) { echo "Caught signal $no \n" ; $this -> base -> exit (); } } $base = new EventBase (); $c = new MyEventSignal ( $base ); $base -> loop (); ?> Note that signal callbacks are run in the event loop after the signal occurs, so it is saf ...
https://man.mtool.work/php/8.3/event.constructing.signal.events.html
Event::add — Makes event pending | PHP 8.3 10101
Event::add (PECL event >= 1.2.6-beta) Event::add — Makes event pending 説明 public function Event::add ( float $timeout = ? ): bool Marks event pending. Non-pending event will never occur, and the event callback will never be called. In con ... -color=auto examp $ kill -TERM 3976 At the first terminal window you should catch the following: Caught signal 15 */ class MyEventSignal { private $base , $ev ; public function __construct ( $base ) { $this -> base = $base ; $this -> ev = Event :: signal ( $b ... ntSighandler ( $no , $c ) { echo "Caught signal $no \n" ; $this -> base -> exit (); } } $base = new EventBase (); $c = new MyEventSignal ( $base ); $base -> loop (); ?> 上の例の出力は、 たとえば以下のようになります。 Caught signal 15 例2 Adding a timer <?php ...
https://man.mtool.work/php/8.3/event.add.html
例 | PHP 8.3 6715
例 例1 Simple HTTP client <?php // Read callback function readcb ( $bev , $base ) { //$input = $bev->input; //$bev->getInput(); //$pos = $input->search("TTP"); $pos = $bev -> input -> search ( "TTP" ); while (( $n = $bev -> input -> remove ... -color=auto examp $ kill -TERM 3976 At the first terminal window you should catch the following: Caught signal 15 */ class MyEventSignal { private $base ; function __construct ( $base ) { $this -> base = $base ; } function eventSighandler ( $no , $c ) { echo ... "Caught signal $no \n" ; event_base_loopexit ( $c -> base ); } } $base = event_base_new (); $c = new MyEventSignal ( $base ); $no = SIGTERM ; $ev = evsignal_new ( $base , $no , array( $c , 'eventSighandler' ), $c ); evsignal_add ( $ev ); ...
https://man.mtool.work/php/8.3/event.examples.html
PREV 1 NEXT