浏览代码

Make sure starpu_init is only called once before calling starpu_shutdown.

Cyril Roelandt 14 年之前
父节点
当前提交
3d87cf096d
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/core/workers.c

+ 6 - 0
src/core/workers.c

@@ -400,6 +400,12 @@ int starpu_init(struct starpu_conf *user_conf)
 #endif
 
 	_STARPU_PTHREAD_MUTEX_LOCK(&init_mutex);
+	if (init_count > 0)
+	{
+		_STARPU_PTHREAD_MUTEX_UNLOCK(&init_mutex);
+		return;
+	}
+		
 	while (initialized == CHANGING)
 		/* Wait for the other one changing it */
 		_STARPU_PTHREAD_COND_WAIT(&init_cond, &init_mutex);