aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-08-08 18:25:48 -0700
committerGarrett D'Amore <garrett@damore.org>2020-08-08 19:30:17 -0700
commit6c5070d9157ab0de667568655f0bbeb60780d701 (patch)
treeab1a03e16907c97e6d76f1d95d79aea0f4a875ce /docs
parentddc0d044dd0fcf4aa1dc333fd5bda0de47850a64 (diff)
downloadnng-6c5070d9157ab0de667568655f0bbeb60780d701.tar.gz
nng-6c5070d9157ab0de667568655f0bbeb60780d701.tar.bz2
nng-6c5070d9157ab0de667568655f0bbeb60780d701.zip
fixes #960 NNG threads inherit application thread name
This also exposes an nng_thread_set_name() function for applications to use. All NNG thread names start with "nng:". Note that support is highly dependent on the operating system.
Diffstat (limited to 'docs')
-rw-r--r--docs/man/CMakeLists.txt1
-rw-r--r--docs/man/libnng.3.adoc1
-rw-r--r--docs/man/nng_thread_set_name.3supp.adoc48
3 files changed, 50 insertions, 0 deletions
diff --git a/docs/man/CMakeLists.txt b/docs/man/CMakeLists.txt
index d17a1cfe..0f175195 100644
--- a/docs/man/CMakeLists.txt
+++ b/docs/man/CMakeLists.txt
@@ -303,6 +303,7 @@ if (NNG_ENABLE_DOC)
nng_random
nng_thread_create
nng_thread_destroy
+ nng_thread_set_name
)
set(NNG_MAN3STR
diff --git a/docs/man/libnng.3.adoc b/docs/man/libnng.3.adoc
index 6107da99..ab1a6b11 100644
--- a/docs/man/libnng.3.adoc
+++ b/docs/man/libnng.3.adoc
@@ -291,6 +291,7 @@ as a convenience to aid in creating portable applications.
|xref:nng_random.3supp.adoc[nng_random()]|get random number
|xref:nng_thread_create.3supp.adoc[nng_thread_create()]|create thread
|xref:nng_thread_destroy.3supp.adoc[nng_thread_destroy()]|reap thread
+|xref:nng_thread_set_name.3supp.adoc[nng_thread_set_name()]|set thread name
|===
=== Byte Streams
diff --git a/docs/man/nng_thread_set_name.3supp.adoc b/docs/man/nng_thread_set_name.3supp.adoc
new file mode 100644
index 00000000..385d2727
--- /dev/null
+++ b/docs/man/nng_thread_set_name.3supp.adoc
@@ -0,0 +1,48 @@
+= nng_thread_set_name(3supp)
+//
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_thread_set_name - set thread name
+
+== SYNOPSIS
+
+[source, c]
+----
+#include <nng/nng.h>
+#include <nng/supplemental/util/platform.h>
+
+void nng_set_thread_name(nng_thread *thread, const char *name);
+----
+
+== DESCRIPTION
+
+The `nng_thread_set_name()` function attempts to set the name for the _thread_ to _name_.
+
+If _thread_ is `NULL`, then the name is set for the current thread.
+
+Support for this, and how names are exposed, varies between platform implementations.
+This function is intended to facilitate debugging applications that may have many threads.
+
+TIP: Internal threads created by _NNG_ will have names beginning with `nng:`.
+
+== RETURN VALUES
+
+None.
+
+== ERRORS
+
+None.
+
+== SEE ALSO
+
+[.text-left]
+xref:nng_thread_create.3supp.adoc[nng_thread_create(3supp)],
+xref:nng.7.adoc[nng(7)]