diff options
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/guide/threads.rst | 14 | ||||
-rw-r--r-- | docs/src/threading.rst | 1 |
2 files changed, 9 insertions, 6 deletions
diff --git a/docs/src/guide/threads.rst b/docs/src/guide/threads.rst index 3b0a07e1..b6a4fd85 100644 --- a/docs/src/guide/threads.rst +++ b/docs/src/guide/threads.rst @@ -79,18 +79,21 @@ The mutex functions are a **direct** map to the pthread equivalents. .. literalinclude:: ../../../include/uv.h :lines: 1355-1360 -The ``uv_mutex_init()`` and ``uv_mutex_trylock()`` functions will return 0 on -success, and an error code otherwise. +The ``uv_mutex_init()``, ``uv_mutex_init_recursive()`` and ``uv_mutex_trylock()`` +functions will return 0 on success, and an error code otherwise. If `libuv` has been compiled with debugging enabled, ``uv_mutex_destroy()``, ``uv_mutex_lock()`` and ``uv_mutex_unlock()`` will ``abort()`` on error. Similarly ``uv_mutex_trylock()`` will abort if the error is anything *other than* ``EAGAIN`` or ``EBUSY``. -Recursive mutexes are supported by some platforms, but you should not rely on -them. The BSD mutex implementation will raise an error if a thread which has +Recursive mutexes are supported, but you should not rely on them. Also, they +should not be used with ``uv_cond_t`` variables. + +The default BSD mutex implementation will raise an error if a thread which has locked a mutex attempts to lock it again. For example, a construct like:: + uv_mutex_init(a_mutex); uv_mutex_lock(a_mutex); uv_thread_create(thread_id, entry, (void *)a_mutex); uv_mutex_lock(a_mutex); @@ -102,8 +105,7 @@ return an error in the second call to ``uv_mutex_lock()``. .. note:: - Mutexes on linux support attributes for a recursive mutex, but the API is - not exposed via libuv. + Mutexes on Windows are always recursive. Locks ~~~~~ diff --git a/docs/src/threading.rst b/docs/src/threading.rst index e876dde1..bca8ba1d 100644 --- a/docs/src/threading.rst +++ b/docs/src/threading.rst @@ -91,6 +91,7 @@ Functions return 0 on success or an error code < 0 (unless the return type is void, of course). .. c:function:: int uv_mutex_init(uv_mutex_t* handle) +.. c:function:: int uv_mutex_init_recursive(uv_mutex_t* handle) .. c:function:: void uv_mutex_destroy(uv_mutex_t* handle) .. c:function:: void uv_mutex_lock(uv_mutex_t* handle) .. c:function:: int uv_mutex_trylock(uv_mutex_t* handle) |