1 #include "test/jemalloc_test.h" 2 3 #ifdef _WIN32 4 void 5 thd_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 13 void 14 thd_join(thd_t thd, void **ret) 15 { 16 17 WaitForSingleObject(thd, INFINITE); 18 } 19 20 #else 21 void 22 thd_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 29 void 30 thd_join(thd_t thd, void **ret) 31 { 32 33 pthread_join(thd, ret); 34 } 35 #endif 36