aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2024-11-27 12:52:18 +0100
committerGitHub <noreply@github.com>2024-11-27 12:52:18 +0100
commit61c966cf0b4b6b5fc44d5ab3678cf5d0caef249d (patch)
treeb40a8e28b1eb0b2c31e05bd16f682511619a544d /docs/src
parentb7d07d78e976acc453c9ba8f8409650c2ad8a585 (diff)
downloadlibuv-61c966cf0b4b6b5fc44d5ab3678cf5d0caef249d.tar.gz
libuv-61c966cf0b4b6b5fc44d5ab3678cf5d0caef249d.zip
src: add uv_thread_set/getname() methods (#4599)
`uv_thread_setname()` sets the name of the current thread. Different platforms define different limits on the max number of characters a thread name can be: Linux, IBMi (16), macOS (64), Windows (32767), and NetBSD (32), etc. `uv_thread_setname()` will truncate it in case `name` is larger than the limit of the platform. `uv_thread_getname()` gets the name of the thread specified by `tid`. The thread name is copied into the buffer pointed to by `name`. The `size` parameter specifies the size of the buffer pointed to by `name`. The buffer should be large enough to hold the name of the thread plus the trailing NUL, or it will be truncated to fit.
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/threading.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/src/threading.rst b/docs/src/threading.rst
index 72f8bae0..f40cf0a3 100644
--- a/docs/src/threading.rst
+++ b/docs/src/threading.rst
@@ -140,6 +140,23 @@ Threads
.. c:function:: int uv_thread_join(uv_thread_t *tid)
.. c:function:: int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2)
+.. c:function:: int uv_thread_setname(const char* name)
+
+ Sets the name of the current thread. Different platforms define different limits on the max number of characters
+ a thread name can be: Linux, IBM i (16), macOS (64), Windows (32767), and NetBSD (32), etc. `uv_thread_setname()`
+ will truncate it in case `name` is larger than the limit of the platform.
+
+ .. versionadded:: 1.50.0
+
+.. c:function:: int uv_thread_getname(uv_thread_t* tid, char* name, size_t* size)
+
+ Gets the name of the thread specified by `tid`. The thread name is copied, with the trailing NUL, into the buffer
+ pointed to by `name`. The `size` parameter specifies the size of the buffer pointed to by `name`.
+ The buffer should be large enough to hold the name of the thread plus the trailing NUL, or it will be truncated to fit
+ with the trailing NUL.
+
+ .. versionadded:: 1.50.0
+
.. c:function:: int uv_thread_setpriority(uv_thread_t tid, int priority)
If the function succeeds, the return value is 0.
If the function fails, the return value is less than zero.