aboutsummaryrefslogtreecommitdiff
path: root/docs/src/guide/basics.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src/guide/basics.rst')
-rw-r--r--docs/src/guide/basics.rst23
1 files changed, 19 insertions, 4 deletions
diff --git a/docs/src/guide/basics.rst b/docs/src/guide/basics.rst
index 457fb15c..2b21d730 100644
--- a/docs/src/guide/basics.rst
+++ b/docs/src/guide/basics.rst
@@ -71,7 +71,7 @@ architecture of libuv and its background. If you have no prior experience with
either libuv or libev, it is a quick, useful watch.
libuv's event loop is explained in more detail in the `documentation
-<http://docs.libuv.org/en/v1.x/design.html#the-i-o-loop>`_.
+<https://docs.libuv.org/en/v1.x/design.html#the-i-o-loop>`_.
.. raw:: html
@@ -109,6 +109,11 @@ A default loop is provided by libuv and can be accessed using
``uv_default_loop()``. You should use this loop if you only want a single
loop.
+.. rubric:: default-loop/main.c
+.. literalinclude:: ../../code/default-loop/main.c
+ :language: c
+ :linenos:
+
.. note::
node.js uses the default loop as its main loop. If you are writing bindings
@@ -119,9 +124,9 @@ loop.
Error handling
--------------
-Initialization functions or synchronous functions which may fail return a negative number on error. Async functions that may fail will pass a status parameter to their callbacks. The error messages are defined as ``UV_E*`` `constants`_.
+Initialization functions or synchronous functions which may fail return a negative number on error. Async functions that may fail will pass a status parameter to their callbacks. The error messages are defined as ``UV_E*`` `constants`_.
-.. _constants: http://docs.libuv.org/en/v1.x/errors.html#error-constants
+.. _constants: https://docs.libuv.org/en/v1.x/errors.html#error-constants
You can use the ``uv_strerror(int)`` and ``uv_err_name(int)`` functions
to get a ``const char *`` describing the error or the error name respectively.
@@ -134,7 +139,7 @@ Handles and Requests
libuv works by the user expressing interest in particular events. This is
usually done by creating a **handle** to an I/O device, timer or process.
Handles are opaque structs named as ``uv_TYPE_t`` where type signifies what the
-handle is used for.
+handle is used for.
.. rubric:: libuv watchers
.. code-block:: c
@@ -169,6 +174,16 @@ handle is used for.
typedef struct uv_udp_send_s uv_udp_send_t;
typedef struct uv_fs_s uv_fs_t;
typedef struct uv_work_s uv_work_t;
+ typedef struct uv_random_s uv_random_t;
+
+ /* None of the above. */
+ typedef struct uv_env_item_s uv_env_item_t;
+ typedef struct uv_cpu_info_s uv_cpu_info_t;
+ typedef struct uv_interface_address_s uv_interface_address_t;
+ typedef struct uv_dirent_s uv_dirent_t;
+ typedef struct uv_passwd_s uv_passwd_t;
+ typedef struct uv_utsname_s uv_utsname_t;
+ typedef struct uv_statfs_s uv_statfs_t;
Handles represent long-lived objects. Async operations on such handles are