About event persistence
By default, whenever a pending event becomes active (because its file descriptor is ready to read or write, or because its timeout expires), it becomes non-pending right before its callback is executed. Thus, to make the event pending again one may call Event::add() on it again from inside the callback function.
If the
Event::PERSIST
flag is set on an event, however, the event is
persistent
. This means that event remains pending even when its callback is activated.
Event::del()
method can be called to make it non-pending.
The timeout on a persistent event resets whenever the event's callback runs.
Thus, if one has an event with flags
Event::READ
|
Event::PERSIST
and a timeout of five seconds, the event will become active:
-
Whenever the socket or file descriptor is ready for reading.
-
Whenever five seconds have passed since the event last became active.
See also » Fast portable non-blocking network programming with Libevent, About Event Persistence
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-event.persistence.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
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.