From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:51 +0000 (-0700) Subject: VThreadBase: Final cleanups X-Git-Tag: stable-10.2.0~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd7b6d0c9575f9728f425d3043fc87639bc2cab0;p=thirdparty%2Fopen-vm-tools.git VThreadBase: Final cleanups --- diff --git a/open-vm-tools/lib/include/vthreadBase.h b/open-vm-tools/lib/include/vthreadBase.h index 11534ff2b..f786fe0be 100644 --- a/open-vm-tools/lib/include/vthreadBase.h +++ b/open-vm-tools/lib/include/vthreadBase.h @@ -136,11 +136,6 @@ void VThreadBase_SetName(const char *name); /* For implementing a thread library */ void VThreadBase_ForgetSelf(void); -/* - * See PR 1626963 and function documentation before thinking about using this. - */ -void VThreadBase_DeInitialize(void); - /* Match up historical VThread_ names with VThreadBase_ names */ static INLINE const char * VThread_CurName(void) diff --git a/open-vm-tools/lib/misc/vthreadBase.c b/open-vm-tools/lib/misc/vthreadBase.c index 2efc14481..fca5860e8 100644 --- a/open-vm-tools/lib/misc/vthreadBase.c +++ b/open-vm-tools/lib/misc/vthreadBase.c @@ -178,30 +178,6 @@ static __thread char vthreadName[VTHREADBASE_MAX_NAME]; #endif /* VMW_HAVE_TLS */ -/* - *----------------------------------------------------------------------------- - * - * VThreadBase_DeInitialize -- - * - * (Vestigial. Will be removed shortly -- kevinc) - * - * See PR 1626963 - * - * Results: - * None - * - * Side effects: - * None - * - *----------------------------------------------------------------------------- - */ - -void -VThreadBase_DeInitialize(void) -{ -} - - /* *----------------------------------------------------------------------------- * @@ -465,11 +441,7 @@ VThreadBase_CurName(void) * support for the platform. */ -#ifdef HAVE_TLS - static __thread char name[48]; -#else static char name[48]; -#endif VThreadBaseSafeName(name, sizeof name); return name; } @@ -477,52 +449,6 @@ VThreadBase_CurName(void) } -/* - *----------------------------------------------------------------------------- - * - * VThreadBase_ForgetSelf -- - * - * Forget the TLS parts of a thread. - * - * If not intending to reallocate TLS, avoid querying the thread's - * VThread_CurName between this call and thread destruction. - * - * Results: - * None. - * - * Side effects: - * None. - * - *----------------------------------------------------------------------------- - */ - -void -VThreadBase_ForgetSelf(void) -{ - if (vmx86_debug) { - Log("Forgetting VThreadID %" FMT64 "d (\"%s\").\n", - VThread_CurID(), VThread_CurName()); - } - - /* - * The VThreadID is fixed (see StableID above). - * Only the name needs clearing. - */ -#if defined VMW_HAVE_TLS - memset(vthreadName, '\0', sizeof vthreadName); -#else - char *buf; - - ASSERT(vthreadNameKey != 0); - ASSERT(!VThreadBase_IsInSignal()); - - buf = pthread_getspecific(vthreadNameKey); - pthread_setspecific(vthreadNameKey, NULL); - free(buf); -#endif -} - - /* *----------------------------------------------------------------------------- * @@ -582,6 +508,52 @@ VThreadBase_SetName(const char *name) // IN: new name } +/* + *----------------------------------------------------------------------------- + * + * VThreadBase_ForgetSelf -- + * + * Forget the TLS parts of a thread. + * + * If not intending to reallocate TLS, avoid querying the thread's + * VThread_CurName between this call and thread destruction. + * + * Results: + * None. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +void +VThreadBase_ForgetSelf(void) +{ + if (vmx86_debug) { + Log("Forgetting VThreadID %" FMT64 "d (\"%s\").\n", + VThread_CurID(), VThread_CurName()); + } + + /* + * The VThreadID is fixed (see StableID above). + * Only the name needs clearing. + */ +#if defined VMW_HAVE_TLS + memset(vthreadName, '\0', sizeof vthreadName); +#else + char *buf; + + ASSERT(vthreadNameKey != 0); + ASSERT(!VThreadBase_IsInSignal()); + + buf = pthread_getspecific(vthreadNameKey); + pthread_setspecific(vthreadNameKey, NULL); + free(buf); +#endif +} + + #if !defined _WIN32 /* *-----------------------------------------------------------------------------