implement malloc_getcpu for windows

This commit is contained in:
Leonardo Santagada 2018-10-31 12:03:42 +01:00 committed by Qi Wang
parent 4e920d2c9d
commit daa0e436ba
2 changed files with 4 additions and 2 deletions

View File

@ -10,7 +10,9 @@
JEMALLOC_ALWAYS_INLINE malloc_cpuid_t JEMALLOC_ALWAYS_INLINE malloc_cpuid_t
malloc_getcpu(void) { malloc_getcpu(void) {
assert(have_percpu_arena); assert(have_percpu_arena);
#if defined(JEMALLOC_HAVE_SCHED_GETCPU) #if defined(_WIN32)
return GetCurrentProcessorNumber();
#elif defined(JEMALLOC_HAVE_SCHED_GETCPU)
return (malloc_cpuid_t)sched_getcpu(); return (malloc_cpuid_t)sched_getcpu();
#else #else
not_reached(); not_reached();

View File

@ -161,7 +161,7 @@ static const bool config_log =
false false
#endif #endif
; ;
#ifdef JEMALLOC_HAVE_SCHED_GETCPU #if defined(_WIN32) || defined(JEMALLOC_HAVE_SCHED_GETCPU)
/* Currently percpu_arena depends on sched_getcpu. */ /* Currently percpu_arena depends on sched_getcpu. */
#define JEMALLOC_PERCPU_ARENA #define JEMALLOC_PERCPU_ARENA
#endif #endif