@@ -665,7 +665,8 @@ function uv_queue_work(UVLoop $loop, callable $callback, callable $after_callbac
665665}
666666
667667/**
668- * Initialize the handle.
668+ * Initialize the `UVIdle` handle watcher.
669+ * Idle watchers get invoked every loop iteration.
669670 *
670671 * @param UVLoop $loop uv_loop handle.
671672 *
@@ -676,7 +677,21 @@ function uv_idle_init(UVLoop $loop = null)
676677}
677678
678679/**
679- * Start the handle with the given callback.
680+ * Start the Idle handle with the given callback.
681+ *
682+ * The callbacks of idle handles are invoked once per event loop.
683+ *
684+ * The idle callback can be used to perform some very low priority activity.
685+ * For example, you could dispatch a summary of the daily application performance to the
686+ * developers for analysis during periods of idleness, or use the application’s CPU time
687+ * to perform SETI calculations :)
688+ *
689+ * An idle watcher is also useful in a GUI application.
690+ *
691+ * Say you are using an event loop for a file download. If the TCP socket is still being established
692+ * and no other events are present your event loop will pause (block), which means your progress bar
693+ * will freeze and the user will face an unresponsive application. In such a case queue up and idle
694+ * watcher to keep the UI operational.
680695 *
681696 * @param UVIdle $idle uv_idle handle.
682697 * @param callable $callback expects (UVIdle $handle)
@@ -686,7 +701,7 @@ function uv_idle_start(UVIdle $idle, callable $callback)
686701}
687702
688703/**
689- * Stop the handle, the callback will no longer be called.
704+ * Stop the Idle handle, the callback will no longer be called.
690705 *
691706 * @param UVIdle $idle uv_idle handle.
692707 */
@@ -695,7 +710,12 @@ function uv_idle_stop(UVIdle $idle)
695710}
696711
697712/**
698- * Initialize the handle.
713+ * Initialize the `UVPrepare` handle watcher.
714+ * Prepare watchers get invoked before polling for I/O events.
715+ *
716+ * Their main purpose is to integrate other event mechanisms into `libuv` and their
717+ * use is somewhat advanced. They could be used, for example, to track variable changes,
718+ * implement your own watchers.
699719 *
700720 * @param UVLoop $loop uv loop handle.
701721 *
@@ -706,7 +726,7 @@ function uv_prepare_init(UVLoop $loop = null)
706726}
707727
708728/**
709- * Start the handle with the given callback.
729+ * Start the Prepare handle with the given callback.
710730 *
711731 * @param UVPrepare $handle UV handle (prepare)
712732 * @param callable $callback expects (UVPrepare $prepare, int $status).
@@ -716,7 +736,7 @@ function uv_prepare_start(UVPrepare $handle, callable $callback)
716736}
717737
718738/**
719- * Stop the handle, the callback will no longer be called.
739+ * Stop the Prepare handle, the callback will no longer be called.
720740 *
721741 * @param UVPrepare $handle UV handle (prepare).
722742 */
@@ -725,7 +745,12 @@ function uv_prepare_stop(UVPrepare $handle)
725745}
726746
727747/**
728- * Initialize the handle.
748+ * Initialize the `UVCheck` handle watcher.
749+ * Check watchers get invoked after polling for I/O events.
750+ *
751+ * Their main purpose is to integrate other event mechanisms into `libuv` and their
752+ * use is somewhat advanced. They could be used, for example, to track variable changes,
753+ * implement your own watchers.
729754 *
730755 * @param UVLoop $loop uv loop handle
731756 *
@@ -736,21 +761,7 @@ function uv_check_init(UVLoop $loop = null)
736761}
737762
738763/**
739- * Start the handle with the given callback.
740- *
741- * The callbacks of idle handles are invoked once per event loop.
742- *
743- * The idle callback can be used to perform some very low priority activity.
744- * For example, you could dispatch a summary of the daily application performance to the
745- * developers for analysis during periods of idleness, or use the application’s CPU time
746- * to perform SETI calculations :)
747- *
748- * An idle watcher is also useful in a GUI application.
749- *
750- * Say you are using an event loop for a file download. If the TCP socket is still being established
751- * and no other events are present your event loop will pause (block), which means your progress bar
752- * will freeze and the user will face an unresponsive application. In such a case queue up and idle
753- * watcher to keep the UI operational.
764+ * Start the Check handle with the given callback.
754765 *
755766 * @param UVCheck $handle UV handle (check).
756767 * @param callable $callback expects (UVCheck $check, int $status).
@@ -760,7 +771,7 @@ function uv_check_start(UVCheck $handle, callable $callback)
760771}
761772
762773/**
763- * Stop the handle, the callback will no longer be called.
774+ * Stop the Check handle, the callback will no longer be called.
764775 *
765776 * @param UVCheck $handle UV handle (check).
766777 */
0 commit comments