@@ -33,6 +33,7 @@ Module Name:
3333#include " threadinfo.hpp"
3434#include " synchobjects.hpp"
3535#include < errno.h>
36+ #include < minipal/thread.h>
3637
3738namespace CorUnix
3839{
@@ -91,13 +92,6 @@ namespace CorUnix
9192 HANDLE *phThread
9293 );
9394
94- PAL_ERROR
95- InternalSetThreadDescription (
96- CPalThread *,
97- HANDLE,
98- PCWSTR
99- );
100-
10195 PAL_ERROR
10296 CreateThreadData (
10397 CPalThread **ppThread
@@ -192,14 +186,6 @@ namespace CorUnix
192186 int
193187 );
194188
195- friend
196- PAL_ERROR
197- InternalSetThreadDescription (
198- CPalThread *,
199- HANDLE,
200- PCWSTR
201- );
202-
203189 friend
204190 PAL_ERROR
205191 CreateThreadData (
@@ -723,50 +709,9 @@ TLSCleanup(
723709extern PAL_ActivationFunction g_activationFunction;
724710extern PAL_SafeActivationCheckFunction g_safeActivationCheckFunction;
725711
726- /* ++
727- Macro:
728- THREADSilentGetCurrentThreadId
729-
730- Abstract:
731- Same as GetCurrentThreadId, but it doesn't output any traces.
732- It is useful for tracing functions to display the thread ID
733- without generating any new traces.
734-
735- TODO: how does the perf of pthread_self compare to
736- InternalGetCurrentThread when we find the thread in the
737- cache?
738-
739- If the perf of pthread_self is comparable to that of the stack
740- bounds based lookaside system, why aren't we using it in the
741- cache?
742-
743- In order to match the thread ids that debuggers use at least for
744- linux we need to use gettid().
745-
746- --*/
747- #if defined(__linux__)
748- #define PlatformGetCurrentThreadId () (SIZE_T)syscall(SYS_gettid)
749- #elif defined(__APPLE__)
750- inline SIZE_T PlatformGetCurrentThreadId () {
751- uint64_t tid;
752- pthread_threadid_np (pthread_self (), &tid);
753- return (SIZE_T)tid;
754- }
755- #elif defined(__FreeBSD__)
756- #include < pthread_np.h>
757- #define PlatformGetCurrentThreadId () (SIZE_T)pthread_getthreadid_np()
758- #elif defined(__NetBSD__)
759- #include < lwp.h>
760- #define PlatformGetCurrentThreadId () (SIZE_T)_lwp_self()
761- #else
762- #define PlatformGetCurrentThreadId () (SIZE_T)pthread_self()
763- #endif
764-
765- inline SIZE_T THREADSilentGetCurrentThreadId () {
766- static __thread SIZE_T tid;
767- if (!tid)
768- tid = PlatformGetCurrentThreadId ();
769- return tid;
712+ inline SIZE_T THREADSilentGetCurrentThreadId ()
713+ {
714+ return minipal_get_current_thread_id ();
770715}
771716
772717#endif // _PAL_THREAD_HPP_
0 commit comments