diff options
author | daan <daanl@outlook.com> | 2020-02-02 14:31:28 -0800 |
---|---|---|
committer | daan <daanl@outlook.com> | 2020-02-02 14:31:28 -0800 |
commit | 07fbe4f80f04a417bb19ac83113f73e1d1db3393 (patch) | |
tree | 0f028bf3f04a06d566847e2a0f45a7e64b33be71 /include/mimalloc-internal.h | |
parent | 8bc20631e47b8c0ec79efb5f2452e958bffb4558 (diff) |
fixes for dragonfly
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index cfbdc9c..b11cb5f 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -285,6 +285,7 @@ mi_heap_t* _mi_heap_main_get(void); // statically allocated main backing hea #elif defined(__OpenBSD__) #define MI_TLS_PTHREAD_SLOT_OFS (6*sizeof(int) + 1*sizeof(void*)) // offset `retval` <https://github.com/openbsd/src/blob/master/lib/libc/include/thread_private.h#L371> #elif defined(__DragonFly__) +#warning "mimalloc is not working correctly on DragonFly yet." #define MI_TLS_PTHREAD_SLOT_OFS (4 + 1*sizeof(void*)) // offset `uniqueid` (also used by gdb?) <https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/lib/libthread_xu/thread/thr_private.h#L458> #endif #endif @@ -295,6 +296,12 @@ static inline void* mi_tls_slot(size_t slot); // forward declaration #include <pthread.h> static inline mi_heap_t** mi_tls_pthread_heap_slot(void) { pthread_t self = pthread_self(); + #if defined(__DragonFly__) + if (self==NULL) { + static mi_heap_t* pheap_main = _mi_heap_main_get(); + return &pheap_main; + } + #endif return (mi_heap_t**)((uint8_t*)self + MI_TLS_PTHREAD_SLOT_OFS); } #elif defined(MI_TLS_PTHREAD) |