浏览代码

src/core: add function to deinitialize pthread key current_task_key

Nathalie Furmento 10 年之前
父节点
当前提交
0cab1db7d3
共有 3 个文件被更改,包括 9 次插入2 次删除
  1. 6 1
      src/core/task.c
  2. 2 1
      src/core/task.h
  3. 1 0
      src/core/workers.c

+ 6 - 1
src/core/task.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2015  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015  Centre National de la Recherche Scientifique
  * Copyright (C) 2011  Télécom-SudParis
  * Copyright (C) 2011, 2014  INRIA
  *
@@ -988,6 +988,11 @@ void _starpu_initialize_current_task_key(void)
 	STARPU_PTHREAD_KEY_CREATE(&current_task_key, NULL);
 }
 
+void _starpu_deinitialize_current_task_key(void)
+{
+	STARPU_PTHREAD_KEY_DELETE(current_task_key);
+}
+
 /* Return the task currently executed by the worker, or NULL if this is called
  * either from a thread that is not a task or simply because there is no task
  * being executed at the moment. */

+ 2 - 1
src/core/task.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2014  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2013, 2015  Centre National de la Recherche Scientifique
  * Copyright (C) 2011, 2014 INRIA
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -36,6 +36,7 @@ int _starpu_task_test_termination(struct starpu_task *task);
  * _starpu_initialize_current_task_key initializes this pthread key and
  * _starpu_set_current_task updates its current value. */
 void _starpu_initialize_current_task_key(void);
+void _starpu_deinitialize_current_task_key(void);
 void _starpu_set_current_task(struct starpu_task *task);
 
 /* NB the second argument makes it possible to count regenerable tasks only

+ 1 - 0
src/core/workers.c

@@ -1453,6 +1453,7 @@ void starpu_shutdown(void)
 	starpu_profiling_bus_helper_display_summary();
 	starpu_profiling_worker_helper_display_summary();
 
+	_starpu_deinitialize_current_task_key();
 	_starpu_deinitialize_registered_performance_models();
 
 	_starpu_watchdog_shutdown();