PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

The Event class | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

The Event class

(PECL event >= 1.2.6-beta)

はじめに

Event class represents and event firing on a file descriptor being ready to read from or write to; a file descriptor becoming ready to read from or write to(edge-triggered I/O only); a timeout expiring; a signal occuring; a user-triggered event.

Every event is associated with EventBase . However, event will never fire until it is added (via Event::add() ). An added event remains in pending state until the registered event occurs, thus turning it to active state. To handle events user may register a callback which is called when event becomes active. If event is configured persistent , it remains pending. If it is not persistent, it stops being pending when it's callback runs. Event::del() method deletes event, thus making it non-pending. By means of Event::add() method it could be added again.

クラス概要

final Event {
/* Constants */
const integer ET = 32 ;
const integer PERSIST = 16 ;
const integer READ = 2 ;
const integer WRITE = 4 ;
const integer SIGNAL = 8 ;
const integer TIMEOUT = 1 ;
/* プロパティ */
public readonly bool $pending ;
/* メソッド */
public bool add ([ double $timeout ] )
public bool addSignal ([ double $timeout ] )
public bool addTimer ([ double $timeout ] )
public __construct ( EventBase $base , mixed $fd , int $what , callable $cb [, mixed $arg = NULL ] )
public bool del ( void )
public bool delSignal ( void )
public bool delTimer ( void )
public void free ( void )
public static array getSupportedMethods ( void )
public bool pending ( int $flags )
public bool set ( EventBase $base , mixed $fd [, int $what [, callable $cb [, mixed $arg ]]] )
public bool setPriority ( int $priority )
public bool setTimer ( EventBase $base , callable $cb [, mixed $arg ] )
public static Event signal ( EventBase $base , int $signum , callable $cb [, mixed $arg ] )
public static Event timer ( EventBase $base , callable $cb [, mixed $arg ] )
}

プロパティ

pending

Whether event is pending. See About event persistence .

定義済み定数

Event::ET

Indicates that the event should be edge-triggered, if the underlying event base backend supports edge-triggered events. This affects the semantics of Event::READ and Event::WRITE .

Event::PERSIST

Indicates that the event is persistent. See About event persistence .

Event::READ

This flag indicates an event that becomes active when the provided file descriptor(usually a stream resource, or socket) is ready for reading.

Event::WRITE

This flag indicates an event that becomes active when the provided file descriptor(usually a stream resource, or socket) is ready for reading.

Event::SIGNAL

Used to implement signal detection. See "Constructing signal events" below.

Event::TIMEOUT

This flag indicates an event that becomes active after a timeout elapses.

The Event::TIMEOUT flag is ignored when constructing an event: one can either set a timeout when event is added , or not. It is set in the $what argument to the callback function when a timeout has occurred.

目次


忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「The Event class」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | The Event class」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: