瀏覽代碼

Add starpu_get_env_number_default

Samuel Thibault 11 年之前
父節點
當前提交
3bebdbb45e
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      include/starpu_util.h

+ 9 - 1
include/starpu_util.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2013  Université de Bordeaux 1
+ * Copyright (C) 2010-2014  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -249,6 +249,14 @@ static __starpu_inline int starpu_get_env_number(const char *str)
 	}
 }
 
+static __starpu_inline int starpu_get_env_number_default(const char *str, int defval)
+{
+	int ret = starpu_get_env_number(str);
+	if (ret == -1)
+		ret = defval;
+	return ret;
+}
+
 void starpu_execute_on_each_worker(void (*func)(void *), void *arg, uint32_t where);
 
 void starpu_execute_on_each_worker_ex(void (*func)(void *), void *arg, uint32_t where, const char *name);