From 6c5070d9157ab0de667568655f0bbeb60780d701 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 8 Aug 2020 18:25:48 -0700 Subject: 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. --- src/supplemental/util/platform.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/supplemental') diff --git a/src/supplemental/util/platform.c b/src/supplemental/util/platform.c index 468582bd..8898b680 100644 --- a/src/supplemental/util/platform.c +++ b/src/supplemental/util/platform.c @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. +// Copyright 2020 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -52,12 +52,18 @@ nng_thread_create(nng_thread **thrp, void (*func)(void *), void *arg) return (0); } +void +nng_thread_set_name(nng_thread *thr, const char *name) +{ + nni_thr_set_name((void *)thr, name); +} + // Destroy a thread (waiting for it to complete.) When this function // returns all resources for the thread are cleaned up. void -nng_thread_destroy(nng_thread *thrp) +nng_thread_destroy(nng_thread *thr) { - nni_thr *t = (void *) thrp; + nni_thr *t = (void *) thr; nni_thr_fini(t); NNI_FREE_STRUCT(t); } -- cgit v1.2.3-70-g09d2