From 16c08efe62a4a079d0d44aa59b6daf302cfafe73 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 7 Jul 2023 14:21:25 -0400 Subject: [PATCH] MT#56374 move pthread helper functions to auxlib The poller (also in lib) depends on this. Change-Id: Iabf7c2ddef129401c19ae6a1f4f391ab9eaa4367 --- include/helpers.h | 11 ----------- lib/auxlib.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/helpers.h b/include/helpers.h index 6d009e99d..64497326c 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -304,17 +304,6 @@ INLINE void thread_create_detach(void (*f)(void *), void *a, const char *name) { thread_create_detach_prio(f, a, NULL, 0, name); } -#ifndef ASAN_BUILD -#define thread_cancel_enable() pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) -#define thread_cancel_disable() pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL) -#define thread_sleep_time 10000 /* ms */ -#else -#define thread_cancel_enable() ((void)0) -#define thread_cancel_disable() ((void)0) -#define thread_sleep_time 100 /* ms */ -#endif - - /*** ATOMIC BITFIELD OPERATIONS ***/ diff --git a/lib/auxlib.h b/lib/auxlib.h index bff865ed7..cbe504d7b 100644 --- a/lib/auxlib.h +++ b/lib/auxlib.h @@ -124,6 +124,19 @@ INLINE int __cond_timedwait_tv(cond_t *c, mutex_t *m, const struct timeval *tv) return pthread_cond_timedwait(c, m, &ts); } + +#ifndef ASAN_BUILD +#define thread_cancel_enable() pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) +#define thread_cancel_disable() pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL) +#define thread_sleep_time 10000 /* ms */ +#else +#define thread_cancel_enable() ((void)0) +#define thread_cancel_disable() ((void)0) +#define thread_sleep_time 100 /* ms */ +#endif + + + #ifndef __THREAD_DEBUG #define __debug_mutex_init(m, F, L) pthread_mutex_init(m, NULL)