Blame docs/src/guide/introduction.rst

Packit Service 7c31a4
Introduction
Packit Service 7c31a4
============
Packit Service 7c31a4
Packit Service 7c31a4
This 'book' is a small set of tutorials about using libuv_ as
Packit Service 7c31a4
a high performance evented I/O library which offers the same API on Windows and Unix.
Packit Service 7c31a4
Packit Service 7c31a4
It is meant to cover the main areas of libuv, but is not a comprehensive
Packit Service 7c31a4
reference discussing every function and data structure. The `official libuv
Packit Service 7c31a4
documentation`_ may be consulted for full details.
Packit Service 7c31a4
Packit Service 7c31a4
.. _official libuv documentation: http://docs.libuv.org/en/v1.x/
Packit Service 7c31a4
Packit Service 7c31a4
This book is still a work in progress, so sections may be incomplete, but
Packit Service 7c31a4
I hope you will enjoy it as it grows.
Packit Service 7c31a4
Packit Service 7c31a4
Who this book is for
Packit Service 7c31a4
--------------------
Packit Service 7c31a4
Packit Service 7c31a4
If you are reading this book, you are either:
Packit Service 7c31a4
Packit Service 7c31a4
1) a systems programmer, creating low-level programs such as daemons or network
Packit Service 7c31a4
   services and clients. You have found that the event loop approach is well
Packit Service 7c31a4
   suited for your application and decided to use libuv.
Packit Service 7c31a4
Packit Service 7c31a4
2) a node.js module writer, who wants to wrap platform APIs
Packit Service 7c31a4
   written in C or C++ with a set of (a)synchronous APIs that are exposed to
Packit Service 7c31a4
   JavaScript. You will use libuv purely in the context of node.js. For
Packit Service 7c31a4
   this you will require some other resources as the book does not cover parts
Packit Service 7c31a4
   specific to v8/node.js.
Packit Service 7c31a4
Packit Service 7c31a4
This book assumes that you are comfortable with the C programming language.
Packit Service 7c31a4
Packit Service 7c31a4
Background
Packit Service 7c31a4
----------
Packit Service 7c31a4
Packit Service 7c31a4
The node.js_ project began in 2009 as a JavaScript environment decoupled
Packit Service 7c31a4
from the browser. Using Google's V8_ and Marc Lehmann's libev_, node.js
Packit Service 7c31a4
combined a model of I/O -- evented -- with a language that was well suited to
Packit Service 7c31a4
the style of programming; due to the way it had been shaped by browsers. As
Packit Service 7c31a4
node.js grew in popularity, it was important to make it work on Windows, but
Packit Service 7c31a4
libev ran only on Unix. The Windows equivalent of kernel event notification
Packit Service 7c31a4
mechanisms like kqueue or (e)poll is IOCP. libuv was an abstraction around libev
Packit Service 7c31a4
or IOCP depending on the platform, providing users an API based on libev.
Packit Service 7c31a4
In the node-v0.9.0 version of libuv `libev was removed`_.
Packit Service 7c31a4
Packit Service 7c31a4
Since then libuv has continued to mature and become a high quality standalone
Packit Service 7c31a4
library for system programming. Users outside of node.js include Mozilla's
Packit Service 7c31a4
Rust_ programming language, and a variety_ of language bindings.
Packit Service 7c31a4
Packit Service 7c31a4
This book and the code is based on libuv version `v1.3.0`_.
Packit Service 7c31a4
Packit Service 7c31a4
Code
Packit Service 7c31a4
----
Packit Service 7c31a4
Packit Service 7c31a4
All the code from this book is included as part of the source of the book on
Packit Service 7c31a4
Github. `Clone`_/`Download`_ the book, then build libuv::
Packit Service 7c31a4
Packit Service 7c31a4
    cd libuv
Packit Service 7c31a4
    ./autogen.sh
Packit Service 7c31a4
    ./configure
Packit Service 7c31a4
    make
Packit Service 7c31a4
Packit Service 7c31a4
There is no need to ``make install``. To build the examples run ``make`` in the
Packit Service 7c31a4
``code/`` directory.
Packit Service 7c31a4
Packit Service 7c31a4
.. _Clone: https://github.com/nikhilm/uvbook
Packit Service 7c31a4
.. _Download: https://github.com/nikhilm/uvbook/downloads
Packit Service 7c31a4
.. _v1.3.0: https://github.com/libuv/libuv/tags
Packit Service 7c31a4
.. _V8: https://v8.dev
Packit Service 7c31a4
.. _libev: http://software.schmorp.de/pkg/libev.html
Packit Service 7c31a4
.. _libuv: https://github.com/libuv/libuv
Packit Service 7c31a4
.. _node.js: https://www.nodejs.org
Packit Service 7c31a4
.. _libev was removed: https://github.com/joyent/libuv/issues/485
Packit Service 7c31a4
.. _Rust: https://www.rust-lang.org
Packit Service 7c31a4
.. _variety: https://github.com/libuv/libuv/wiki/Projects-that-use-libuv