浏览代码

Fix crash when joining a thread which has already exited

Samuel Thibault 8 年之前
父节点
当前提交
138eed786c
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/common/thread.c

+ 4 - 0
src/common/thread.c

@@ -73,6 +73,9 @@ int starpu_pthread_create_on(char *name, starpu_pthread_t *thread, const starpu_
 	void *tsd;
 	_STARPU_CALLOC(tsd, MAX_TSD+1, sizeof(void*));
 	*thread = MSG_process_create_with_arguments(name, _starpu_simgrid_thread_start, tsd, host, 2, _args);
+#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 14)
+	MSG_process_ref(*thread);
+#endif
 	return 0;
 }
 
@@ -85,6 +88,7 @@ int starpu_pthread_join(starpu_pthread_t thread STARPU_ATTRIBUTE_UNUSED, void **
 {
 #if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 14)
 	MSG_process_join(thread, 1000000);
+	MSG_process_unref(thread);
 #else
 	MSG_process_sleep(1);
 #endif