michael@0: /* michael@0: * This header should be included by tests, rather than directly including michael@0: * jemalloc/jemalloc.h, because --with-install-suffix may cause the header to michael@0: * have a different name. michael@0: */ michael@0: #include "jemalloc/jemalloc@install_suffix@.h" michael@0: #include "jemalloc/internal/jemalloc_internal.h" michael@0: michael@0: /* Abstraction layer for threading in tests */ michael@0: #ifdef _WIN32 michael@0: #include michael@0: michael@0: typedef HANDLE je_thread_t; michael@0: michael@0: void michael@0: je_thread_create(je_thread_t *thread, void *(*proc)(void *), void *arg) michael@0: { michael@0: LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc; michael@0: *thread = CreateThread(NULL, 0, routine, arg, 0, NULL); michael@0: if (*thread == NULL) { michael@0: malloc_printf("Error in CreateThread()\n"); michael@0: exit(1); michael@0: } michael@0: } michael@0: michael@0: void michael@0: je_thread_join(je_thread_t thread, void **ret) michael@0: { michael@0: WaitForSingleObject(thread, INFINITE); michael@0: } michael@0: michael@0: #else michael@0: #include michael@0: michael@0: typedef pthread_t je_thread_t; michael@0: michael@0: void michael@0: je_thread_create(je_thread_t *thread, void *(*proc)(void *), void *arg) michael@0: { michael@0: michael@0: if (pthread_create(thread, NULL, proc, arg) != 0) { michael@0: malloc_printf("Error in pthread_create()\n"); michael@0: exit(1); michael@0: } michael@0: } michael@0: michael@0: void michael@0: je_thread_join(je_thread_t thread, void **ret) michael@0: { michael@0: michael@0: pthread_join(thread, ret); michael@0: } michael@0: #endif