From 5df3ac3b29927d4d64faf81fcc88ec25b076af9d Mon Sep 17 00:00:00 2001 From: Dave MacLachlan Date: Thu, 9 Mar 2023 09:10:29 -0800 Subject: Add note about using `CurrentThreadIdentityIfPresent()` on darwin based platforms. PiperOrigin-RevId: 515353041 Change-Id: I2c88022d50a3351f70d09a2d63020470889752d9 --- absl/base/internal/thread_identity.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'absl/base') diff --git a/absl/base/internal/thread_identity.h b/absl/base/internal/thread_identity.h index 463acbc7..b99c9575 100644 --- a/absl/base/internal/thread_identity.h +++ b/absl/base/internal/thread_identity.h @@ -170,7 +170,10 @@ struct ThreadIdentity { // // Does not malloc(*), and is async-signal safe. // [*] Technically pthread_setspecific() does malloc on first use; however this -// is handled internally within tcmalloc's initialization already. +// is handled internally within tcmalloc's initialization already. Note that +// darwin does *not* use tcmalloc, so this can catch you if using MallocHooks +// on Apple platforms. Whatever function is calling your MallocHooks will need +// to watch for recursion on Apple platforms. // // New ThreadIdentity objects can be constructed and associated with a thread // by calling GetOrCreateCurrentThreadIdentity() in per-thread-sem.h. -- cgit v1.2.3