diff --git a/be/src/runtime/thread_context.h b/be/src/runtime/thread_context.h index 0d0896cc10..e4a707d2be 100644 --- a/be/src/runtime/thread_context.h +++ b/be/src/runtime/thread_context.h @@ -191,6 +191,11 @@ private: TUniqueId _fragment_instance_id; }; +#if defined(UNDEFINED_BEHAVIOR_SANITIZER) +static ThreadContext* thread_context() { + return thread_context_ptr._ptr; +} +#else // Cache the pointer of bthread local in pthead local, // Avoid calling bthread_getspecific frequently to get bthread local, which has performance problems. static void pthread_attach_bthread() { @@ -225,6 +230,7 @@ static ThreadContext* thread_context() { return thread_context_ptr._ptr; } } +#endif class ScopeMemCount { public: