svn: /phpdoc/en/trunk/reference/libevent/ examples.xml functions/event-add.xml functions/event-free.xml functions/event-new.xml

From: Date: Mon, 18 Jan 2010 21:58:54 +0000
Subject: svn: /phpdoc/en/trunk/reference/libevent/ examples.xml functions/event-add.xml functions/event-free.xml functions/event-new.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-5896@lists.php.net to get a copy of this message
joris Mon, 18 Jan 2010 21:58:54 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=293714 Log: Made the following changes to the libevent documentation: - Changed the examples because the given examples did not work - Fixed documentation of parameters and return values for a few functions Changed paths: U phpdoc/en/trunk/reference/libevent/examples.xml U phpdoc/en/trunk/reference/libevent/functions/event-add.xml U phpdoc/en/trunk/reference/libevent/functions/event-free.xml U phpdoc/en/trunk/reference/libevent/functions/event-new.xml Modified: phpdoc/en/trunk/reference/libevent/examples.xml =================================================================== --- phpdoc/en/trunk/reference/libevent/examples.xml 2010-01-18 21:34:36 UTC (rev 293713) +++ phpdoc/en/trunk/reference/libevent/examples.xml 2010-01-18 21:58:54 UTC (rev 293714) @@ -10,36 +10,35 @@ <![CDATA[ <?php -function callback_func($fd, $events, $arg) +function print_line($fd, $events, $arg) { - static $max_requests; + static $max_requests = 0; $max_requests++; - if ($max_requests == 10) { /* exit loop after 10 writes */ + if ($max_requests == 10) { + // exit loop after 10 writes event_base_loopexit($arg[1]); } - /* read while we can */ - while (false !=== ($data = fread($fd, 4096))) { - echo $data; - } + // print the line + echo fgets($fd); } -/* create base and event */ +// create base and event $base = event_base_new(); $event = event_new(); $fd = STDIN; -/* set event flags */ -event_set($event, $fd, EV_READ | EV_PERSIST, "callback_func", array($event, $base)); -/* set event base */ +// set event flags +event_set($event, $fd, EV_READ | EV_PERSIST, "print_line", array($event, $base)); +// set event base event_base_set($event, $base); -/* enable event */ +// enable event event_add($event); -/* start event loop */ +// start event loop event_base_loop($base); ?> @@ -54,7 +53,7 @@ <![CDATA[ <?php -function callback_func($buf, $arg) +function print_line($buf, $arg) { static $max_requests; @@ -64,22 +63,20 @@ event_base_loopexit($arg); } - /* read while we can */ - while (false !=== ($data = event_buffer_read($buf, 10))) { - echo $data; - } + // print the line + echo event_buffer_read($buf, 4096); } function error_func($buf, $what, $arg) { - /* handle an error */ + // handle errors } $base = event_base_new(); -$b = event_buffer_new(STDIN, "callback_func", NULL, "error_func", $base); +$eb = event_buffer_new(STDIN, "print_line", NULL, "error_func", $base); -event_buffer_base_set($b, $base); -event_buffer_enable($b, EV_READ); +event_buffer_base_set($eb, $base); +event_buffer_enable($eb, EV_READ); event_base_loop($base); Modified: phpdoc/en/trunk/reference/libevent/functions/event-add.xml =================================================================== --- phpdoc/en/trunk/reference/libevent/functions/event-add.xml 2010-01-18 21:34:36 UTC (rev 293713) +++ phpdoc/en/trunk/reference/libevent/functions/event-add.xml 2010-01-18 21:58:54 UTC (rev 293714) @@ -5,7 +5,7 @@ <refname>event_add</refname> <refpurpose>Add an event to the set of monitored events</refpurpose> </refnamediv> - + <refsect1 role="description"> &reftitle.description; <methodsynopsis> @@ -14,8 +14,8 @@ <methodparam choice="opt"><type>int</type><parameter>timeout</parameter><initializer>-1</initializer></methodparam> </methodsynopsis> <para> - <function>event_add</function> schedules the execution of the <parameter>event</parameter> - when the event specified in <function>event_set</function> occurs or in at least the time + <function>event_add</function> schedules the execution of the <parameter>event</parameter> + when the event specified in <function>event_set</function> occurs or in at least the time specified by the <parameter>timeout</parameter> argument. If <parameter>timeout</parameter> was not specified, not timeout is set. The <parameter>event</parameter> must be already initalized by <function>event_set</function> @@ -52,7 +52,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - <function></function> returns or &false; on error. + <function>event_add</function> returns &true; on success or &false; on error. </para> </refsect1> Modified: phpdoc/en/trunk/reference/libevent/functions/event-free.xml =================================================================== --- phpdoc/en/trunk/reference/libevent/functions/event-free.xml 2010-01-18 21:34:36 UTC (rev 293713) +++ phpdoc/en/trunk/reference/libevent/functions/event-free.xml 2010-01-18 21:58:54 UTC (rev 293714) @@ -5,7 +5,7 @@ <refname>event_free</refname> <refpurpose>Free event resource</refpurpose> </refnamediv> - + <refsect1 role="description"> &reftitle.description; <methodsynopsis> @@ -13,7 +13,7 @@ <methodparam><type>resource</type><parameter>event</parameter></methodparam> </methodsynopsis> <para> - Frees previously created event resource. + Frees previously created event resource. </para> </refsect1> @@ -22,21 +22,13 @@ <para> <variablelist> <varlistentry> - <term><parameter>filename</parameter></term> + <term><parameter>event</parameter></term> <listitem> <para> - Path to the Rar archive. + Valid event resource. </para> </listitem> </varlistentry> - <varlistentry> - <term><parameter>password</parameter></term> - <listitem> - <para> - A plain password, if needed. - </para> - </listitem> - </varlistentry> </variablelist> </para> </refsect1> Modified: phpdoc/en/trunk/reference/libevent/functions/event-new.xml =================================================================== --- phpdoc/en/trunk/reference/libevent/functions/event-new.xml 2010-01-18 21:34:36 UTC (rev 293713) +++ phpdoc/en/trunk/reference/libevent/functions/event-new.xml 2010-01-18 21:58:54 UTC (rev 293714) @@ -5,7 +5,7 @@ <refname>event_new</refname> <refpurpose>Create new event</refpurpose> </refnamediv> - + <refsect1 role="description"> &reftitle.description; <methodsynopsis> @@ -13,10 +13,16 @@ <void/> </methodsynopsis> <para> - Creates and returns new event resource. + Creates and returns a new event resource. </para> </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + <function>event_new</function> returns a new event resource on success or &false; on error. + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#5896) next »