mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Always use pthread_equal to compare thread IDs
This change replaces direct comparisons of Pthread thread IDs with calls to pthread_equal. Directly comparing thread IDs is neither portable nor reliable since a thread ID is defined as an opaque type that can be implemented using a structure.
This commit is contained in:
committed by
Guangli Dai
parent
5d5f76ee01
commit
5a634a8d0a
@@ -220,7 +220,8 @@ static uint8_t malloc_slow_flags;
|
||||
/* Used to let the initializing thread recursively allocate. */
|
||||
# define NO_INITIALIZER ((unsigned long)0)
|
||||
# define INITIALIZER pthread_self()
|
||||
# define IS_INITIALIZER (malloc_initializer == pthread_self())
|
||||
# define IS_INITIALIZER \
|
||||
(pthread_equal(malloc_initializer, pthread_self()))
|
||||
static pthread_t malloc_initializer = NO_INITIALIZER;
|
||||
#else
|
||||
# define NO_INITIALIZER false
|
||||
|
||||
Reference in New Issue
Block a user