Rechercher une fonction PHP

The Event class

(PECL event >= 1.2.6-beta)

Introduction

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.

PHP: Event - Manual Home of Manuel PHP  Contents Haut

Class synopsis

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 ;
/* Properties */
public readonly bool $pending ;
/* Methods */
public add ([ float $timeout ] ) : bool
public addSignal ([ float $timeout ] ) : bool
public addTimer ([ float $timeout ] ) : bool
public __construct ( EventBase $base , mixed $fd , int $what , callable $cb [, mixed $arg = NULL ] )
public del ( void ) : bool
public delSignal ( void ) : bool
public delTimer ( void ) : bool
public free ( void ) : void
public static getSupportedMethods ( void ) : array
public pending ( int $flags ) : bool
public set ( EventBase $base , mixed $fd [, int $what [, callable $cb [, mixed $arg ]]] ) : bool
public setPriority ( int $priority ) : bool
public setTimer ( EventBase $base , callable $cb [, mixed $arg ] ) : bool
public static signal ( EventBase $base , int $signum , callable $cb [, mixed $arg ] ) : Event
public static timer ( EventBase $base , callable $cb [, mixed $arg ] ) : Event
}

PHP: Event - Manual Home of Manuel PHP  Contents Haut

Properties

pending

Whether event is pending. See About event persistence .

PHP: Event - Manual Home of Manuel PHP  Contents Haut

Predefined Constants

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.

PHP: Event - Manual Home of Manuel PHP  Contents Haut

Table of Contents

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-class.event.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut