文字

Event::addSignal

(PECL event >= 1.2.6-beta)

Event::addSignalMakes signal event pending

说明

public bool Event::addSignal ([ double $timeout ] )

Event::addSignal() is an alias of Event::add()

范例

Example #1 Event::addSignal() example

<?php

class  MyEventSignal  {
    private 
$base $ev ;

    public function 
__construct ( $base ) {
        
$this -> base  $base ;
        
$this -> ev  Event :: signal ( $base SIGTERM , array( $this 'eventSighandler' ));
        
$this -> ev -> addSignal ();
    }

    public function 
eventSighandler ( $no $c ) {
        echo 
"Caught signal  $no \n" ;
        
$this -> base -> exit ();
    }
}

$base  = new  EventBase ();
$c     = new  MyEventSignal ( $base );

$base -> loop ();
?>

以上例程的输出类似于:

Caught signal 15

参见

  • Event::add() - Makes event pending
  • Event::del() - Makes event non-pending
  • Event::delSignal() - Makes signal event non-pending
  • Event::signal() - Constructs signal event object
上一篇: 下一篇: