static void TestSuite_RunParallel (TestSuite *suite) /* IN */ { ParallelInfo *info; Thread *threads; Mutex mutex; Test *test; int count = 0; int i; ASSERT (suite); Mutex_Init (&mutex); for (test = suite->tests; test; test = test->next) { count++; } threads = calloc (count, sizeof *threads); Memory_Barrier (); for (test = suite->tests, i = 0; test; test = test->next, i++) { info = calloc (1, sizeof *info); info->suite = suite; info->test = test; info->count = &count; info->mutex = &mutex; Thread_Create (&threads [i], TestSuite_ParallelWorker, info); } for (test = suite->tests, i = 0; test; test = test->next, i++) { Thread_Join(threads [i]); } /*if (timeout < 0 || timeout > 600) { timeout = 60; } #ifdef _WIN32 Sleep (timeout * 1000); #else sleep (timeout); #endif */ //fprintf (stderr, "Timed out, aborting!\n"); //abort (); }
static void TestSuite_RunParallel (TestSuite *suite) /* IN */ { ParallelInfo *info; Thread *threads; Mutex mutex; Test *test; int count = 0; int i; ASSERT (suite); Mutex_Init (&mutex); for (test = suite->tests; test; test = test->next) { count++; } threads = (Thread *)calloc (count, sizeof *threads); Memory_Barrier (); for (test = suite->tests, i = 0; test; test = test->next, i++) { info = (ParallelInfo *)calloc (1, sizeof *info); info->suite = suite; info->test = test; info->count = &count; info->mutex = &mutex; Thread_Create (&threads [i], TestSuite_ParallelWorker, info); } #ifdef _WIN32 Sleep (30000); #else sleep (30); #endif _Print_StdErr ("Timed out, aborting!\n"); abort (); }
static void TestSuite_RunParallel (TestSuite *suite) /* IN */ { ParallelInfo *info; pthread_t *threads; pthread_mutex_t mutex; Test *test; int count = 0; int i; ASSERT (suite); assert (0 == pthread_mutex_init (&mutex, NULL)); for (test = suite->tests; test; test = test->next) { count++; } threads = calloc (count, sizeof *threads); Memory_Barrier (); for (test = suite->tests, i = 0; test; test = test->next, i++) { info = calloc (1, sizeof *info); info->suite = suite; info->test = test; info->count = &count; info->mutex = &mutex; pthread_create (&threads [i], NULL, TestSuite_ParallelWorker, info); } sleep (30); fprintf (stderr, "Timed out, aborting!\n"); abort (); }