doc: add thread safety warning for process title

Add a small warning about uv_get_process_title()
and uv_set_process_title() not being thread safe on platforms
other than Windows. Also add a reminder for users to call
uv_setup_args() first.

Fixes: https://github.com/libuv/libuv/issues/1395
PR-URL: https://github.com/libuv/libuv/pull/1396
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Matthew Taylor 2017-07-01 04:46:24 +01:00 committed by cjihrig
parent ad1c828827
commit bdc87005a1

View File

@ -186,17 +186,24 @@ API
.. c:function:: int uv_get_process_title(char* buffer, size_t size)
Gets the title of the current process. If `buffer` is `NULL` or `size` is
zero, `UV_EINVAL` is returned. If `size` cannot accommodate the process
title and terminating `NULL` character, the function returns `UV_ENOBUFS`.
Gets the title of the current process. You *must* call `uv_setup_args`
before calling this function. If `buffer` is `NULL` or `size` is zero,
`UV_EINVAL` is returned. If `size` cannot accommodate the process title and
terminating `NULL` character, the function returns `UV_ENOBUFS`.
.. warning::
`uv_get_process_title` is not thread safe on any platform except Windows.
.. c:function:: int uv_set_process_title(const char* title)
Sets the current process title. On platforms with a fixed size buffer for the
process title the contents of `title` will be copied to the buffer and
truncated if larger than the available space. Other platforms will return
`UV_ENOMEM` if they cannot allocate enough space to duplicate the contents of
`title`.
Sets the current process title. You *must* call `uv_setup_args` before
calling this function. On platforms with a fixed size buffer for the process
title the contents of `title` will be copied to the buffer and truncated if
larger than the available space. Other platforms will return `UV_ENOMEM` if
they cannot allocate enough space to duplicate the contents of `title`.
.. warning::
`uv_set_process_title` is not thread safe on any platform except Windows.
.. c:function:: int uv_resident_set_memory(size_t* rss)