# HG changeset patch # User Tatsuki IHA # Date 1514458266 -32400 # Node ID b8b412a7670aa6005f474cb14522f8539ec75145 # Parent 0223c07c39464a2adafddb2b4adb88a445e03ce8 Fix segmentation fault if multithread diff -r 0223c07c3946 -r b8b412a7670a src/parallel_execution/TaskManagerImpl.cbc --- a/src/parallel_execution/TaskManagerImpl.cbc Thu Dec 28 19:08:04 2017 +0900 +++ b/src/parallel_execution/TaskManagerImpl.cbc Thu Dec 28 19:51:06 2017 +0900 @@ -188,12 +188,21 @@ } taskManager->loopCounter->i = 0; - goto next(...); + goto shutdownTaskManagerImpl2(); } -__code shutdownTaskManagerImpl1(struct TaskManagerImpl* taskManager) { - int i = taskManager->loopCounter->i; - pthread_join(taskManager->workers[i]->thread, NULL); +__code shutdownTaskManagerImpl1(struct TaskManagerImpl* taskManager, __code next(...)) { taskManager->loopCounter->i++; goto shutdownTaskManagerImpl(); } + +__code shutdownTaskManagerImpl2(struct TaskManagerImpl* taskManager, __code next(...)) { + int i = taskManager->loopCounter->i; + if (i < taskManager->numWorker) { + pthread_join(taskManager->workers[i]->thread, NULL); + taskManager->loopCounter->i++; + goto shutdownTaskManagerImpl2(); + } + taskManager->loopCounter->i = 0; + goto next(...); +} diff -r 0223c07c3946 -r b8b412a7670a src/parallel_execution/TimerImpl.cbc --- a/src/parallel_execution/TimerImpl.cbc Thu Dec 28 19:08:04 2017 +0900 +++ b/src/parallel_execution/TimerImpl.cbc Thu Dec 28 19:51:06 2017 +0900 @@ -25,8 +25,6 @@ __code endTimer(struct TimerImpl* timer, __code next(...)) { struct timeval tv; gettimeofday(&tv, NULL); - printf("%0.6f\n", (tv.tv_sec+(double)tv.tv_usec*1e-6) - timer->time); - goto next(...); }