blob: 233242a161e246cb31173ca936bf265ab6a0bd9b [file] [log] [blame]
Jason Evans0f4f1ef2013-12-12 14:41:02 -08001#include "test/jemalloc_test.h"
2
3#ifdef _WIN32
4void
5thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
6{
7 LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc;
8 *thd = CreateThread(NULL, 0, routine, arg, 0, NULL);
9 if (*thd == NULL)
10 test_fail("Error in CreateThread()\n");
11}
12
13void
14thd_join(thd_t thd, void **ret)
15{
16
17 WaitForSingleObject(thd, INFINITE);
18}
19
20#else
21void
22thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
23{
24
25 if (pthread_create(thd, NULL, proc, arg) != 0)
26 test_fail("Error in pthread_create()\n");
27}
28
29void
30thd_join(thd_t thd, void **ret)
31{
32
33 pthread_join(thd, ret);
34}
35#endif