2 * This header should be included by tests, rather than directly including
3 * jemalloc/jemalloc.h, because --with-install-suffix may cause the header to
4 * have a different name.
6 #include "jemalloc/jemalloc@install_suffix@.h"
7 #include "jemalloc/internal/jemalloc_internal.h"
9 /* Abstraction layer for threading in tests */
13 typedef HANDLE je_thread_t
;
16 je_thread_create(je_thread_t
*thread
, void *(*proc
)(void *), void *arg
)
18 LPTHREAD_START_ROUTINE routine
= (LPTHREAD_START_ROUTINE
)proc
;
19 *thread
= CreateThread(NULL
, 0, routine
, arg
, 0, NULL
);
20 if (*thread
== NULL
) {
21 malloc_printf("Error in CreateThread()\n");
27 je_thread_join(je_thread_t thread
, void **ret
)
29 WaitForSingleObject(thread
, INFINITE
);
35 typedef pthread_t je_thread_t
;
38 je_thread_create(je_thread_t
*thread
, void *(*proc
)(void *), void *arg
)
41 if (pthread_create(thread
, NULL
, proc
, arg
) != 0) {
42 malloc_printf("Error in pthread_create()\n");
48 je_thread_join(je_thread_t thread
, void **ret
)
51 pthread_join(thread
, ret
);