summaryrefslogtreecommitdiffstats
path: root/include/jemalloc
diff options
context:
space:
mode:
authorLeonardo Santagada <santagada@gmail.com>2018-10-31 11:03:42 (GMT)
committerQi Wang <interwq@gmail.com>2019-01-08 22:34:45 (GMT)
commitdaa0e436ba232d67b832e1b270b13c5061eebfe9 (patch)
tree10214da54217f57508940a8df4af4de134ab3b8f /include/jemalloc
parent4e920d2c9d5aecc9dec7069a0c9736b1f14eead9 (diff)
downloadjemalloc-daa0e436ba232d67b832e1b270b13c5061eebfe9.zip
jemalloc-daa0e436ba232d67b832e1b270b13c5061eebfe9.tar.gz
jemalloc-daa0e436ba232d67b832e1b270b13c5061eebfe9.tar.bz2
implement malloc_getcpu for windows
Diffstat (limited to 'include/jemalloc')
-rw-r--r--include/jemalloc/internal/jemalloc_internal_inlines_a.h4
-rw-r--r--include/jemalloc/internal/jemalloc_preamble.h.in2
2 files changed, 4 insertions, 2 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_inlines_a.h b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
index 8adc02a..ddde9b4 100644
--- a/include/jemalloc/internal/jemalloc_internal_inlines_a.h
+++ b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
@@ -10,7 +10,9 @@
JEMALLOC_ALWAYS_INLINE malloc_cpuid_t
malloc_getcpu(void) {
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();
#else
not_reached();
diff --git a/include/jemalloc/internal/jemalloc_preamble.h.in b/include/jemalloc/internal/jemalloc_preamble.h.in
index 857fa32..4bfdb32 100644
--- a/include/jemalloc/internal/jemalloc_preamble.h.in
+++ b/include/jemalloc/internal/jemalloc_preamble.h.in
@@ -161,7 +161,7 @@ static const bool config_log =
false
#endif
;
-#ifdef JEMALLOC_HAVE_SCHED_GETCPU
+#if defined(_WIN32) || defined(JEMALLOC_HAVE_SCHED_GETCPU)
/* Currently percpu_arena depends on sched_getcpu. */
#define JEMALLOC_PERCPU_ARENA
#endif