]> git.saurik.com Git - redis.git/blame_incremental - deps/jemalloc/test/jemalloc_test.h.in
redis-check-dump now understands dumps produced by Redis 2.6
[redis.git] / deps / jemalloc / test / jemalloc_test.h.in
... / ...
CommitLineData
1/*
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.
5 */
6#include "jemalloc/jemalloc@install_suffix@.h"
7#include "jemalloc/internal/jemalloc_internal.h"
8
9/* Abstraction layer for threading in tests */
10#ifdef _WIN32
11#include <windows.h>
12
13typedef HANDLE je_thread_t;
14
15void
16je_thread_create(je_thread_t *thread, void *(*proc)(void *), void *arg)
17{
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");
22 exit(1);
23 }
24}
25
26void
27je_thread_join(je_thread_t thread, void **ret)
28{
29 WaitForSingleObject(thread, INFINITE);
30}
31
32#else
33#include <pthread.h>
34
35typedef pthread_t je_thread_t;
36
37void
38je_thread_create(je_thread_t *thread, void *(*proc)(void *), void *arg)
39{
40
41 if (pthread_create(thread, NULL, proc, arg) != 0) {
42 malloc_printf("Error in pthread_create()\n");
43 exit(1);
44 }
45}
46
47void
48je_thread_join(je_thread_t thread, void **ret)
49{
50
51 pthread_join(thread, ret);
52}
53#endif