Problem absl/container/internal/hashtablez_sampler.h (global_next_sample)

77 views
Skip to first unread message

Chris Uzdavinis

unread,
Aug 24, 2020, 8:03:30 PM8/24/20
to Abseil.io
Hi, I was looking at an issue I was seeing in some code regarding the global_next_sample being undefined, and noticed something odd in the absl/container/internal/hashtablez_sampler.h:

#if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
#error ABSL_INTERNAL_HASHTABLEZ_SAMPLE cannot be directly set
#endif  // defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)

#if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
extern ABSL_PER_THREAD_TLS_KEYWORD int64_t global_next_sample;
#endif  // ABSL_PER_THREAD_TLS


The 2nd #ifdef block has the same condition as the 1st, and the first will bail with an error, so we know it's never hitting the 2nd block.  Also, the 2nd block #endif comment indicates it expected a different macro to be tested (ABSL_PER_THREAD_TLS).

While I'm not sure if this is the cause of the issue I was running into, but it looks wrong on its own, so I'm mentioning it here.  (Sorry, just joined so don't know if there's a better place to report this.)

Thanks,
Chris

dma...@google.com

unread,
Aug 24, 2020, 8:40:02 PM8/24/20
to Abseil.io
Thanks for reaching out. This is intentional. hashtablez is an internal only feature. The code to enable it lives between the two blocks you posted, but it is stripped out of the opensource release.

The ABSL_PER_THREAD_TLS comment is an error.
 

Thanks,
Chris
Reply all
Reply to author
Forward
0 new messages