Sha256: 6f54d030345cb27607c03f2760f2f0d617662e669d85ce17badde6f5505721a9

Contents?: true

Size: 1.45 KB

Versions: 28

Compression:

Stored size: 1.45 KB

Contents

.. _async:

:c:type:`uv_async_t` --- Async handle
=====================================

Async handles allow the user to "wakeup" the event loop and get a callback
called from another thread.


Data types
----------

.. c:type:: uv_async_t

    Async handle type.

.. c:type:: void (*uv_async_cb)(uv_async_t* handle)

    Type definition for callback passed to :c:func:`uv_async_init`.


Public members
^^^^^^^^^^^^^^

N/A

.. seealso:: The :c:type:`uv_handle_t` members also apply.


API
---

.. c:function:: int uv_async_init(uv_loop_t* loop, uv_async_t* async, uv_async_cb async_cb)

    Initialize the handle. A NULL callback is allowed.

    .. note::
        Unlike other handle initialization  functions, it immediately starts the handle.

.. c:function:: int uv_async_send(uv_async_t* async)

    Wakeup the event loop and call the async handle's callback.

    .. note::
        It's safe to call this function from any thread. The callback will be called on the
        loop thread.

    .. warning::
        libuv will coalesce calls to :c:func:`uv_async_send`, that is, not every call to it will
        yield an execution of the callback. For example: if :c:func:`uv_async_send` is called 5
        times in a row before the callback is called, the callback will only be called once. If
        :c:func:`uv_async_send` is called again after the callback was called, it will be called
        again.

.. seealso::
    The :c:type:`uv_handle_t` API functions also apply.

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
libuv-2.0.12 ext/libuv/docs/src/async.rst
libuv-2.0.11 ext/libuv/docs/src/async.rst
libuv-3.2.1 ext/libuv/docs/src/async.rst
libuv-3.2.0 ext/libuv/docs/src/async.rst
libuv-3.1.9 ext/libuv/docs/src/async.rst
libuv-3.1.8 ext/libuv/docs/src/async.rst
libuv-3.1.7 ext/libuv/docs/src/async.rst
libuv-3.1.6 ext/libuv/docs/src/async.rst
libuv-3.1.5 ext/libuv/docs/src/async.rst
libuv-3.1.4 ext/libuv/docs/src/async.rst
libuv-3.1.3 ext/libuv/docs/src/async.rst
libuv-3.1.2 ext/libuv/docs/src/async.rst
libuv-3.1.1 ext/libuv/docs/src/async.rst
libuv-3.1.0 ext/libuv/docs/src/async.rst
libuv-3.0.1 ext/libuv/docs/src/async.rst
libuv-3.0.0 ext/libuv/docs/src/async.rst
libuv-2.0.10 ext/libuv/docs/src/async.rst
libuv-2.0.9 ext/libuv/docs/src/async.rst
libuv-2.0.8 ext/libuv/docs/src/async.rst
libuv-2.0.6 ext/libuv/docs/src/async.rst