Selaa lähdekoodia

fix unsafe access to worker state

(cherry picked from commit 868d34b56f54491139f76e77ea55bddce8bab2b0)
Samuel Thibault 6 vuotta sitten
vanhempi
commit
cd7d3c043d
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      src/profiling/profiling.c

+ 3 - 1
src/profiling/profiling.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2017                                Université de Bordeaux
+ * Copyright (C) 2010-2017,2019                           Université de Bordeaux
  * Copyright (C) 2010-2013,2015-2017                      CNRS
  * Copyright (C) 2016                                     Inria
  *
@@ -322,6 +322,7 @@ int starpu_profiling_worker_get_info(int workerid, struct starpu_profiling_worke
 		info->executed_tasks = worker_info[workerid].executed_tasks;
 	}
 
+	STARPU_PTHREAD_MUTEX_LOCK(&_starpu_get_worker_struct(workerid)->sched_mutex);
 	STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
 
 	if (info)
@@ -356,6 +357,7 @@ int starpu_profiling_worker_get_info(int workerid, struct starpu_profiling_worke
 	_starpu_worker_reset_profiling_info_with_lock(workerid);
 
 	STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
+	STARPU_PTHREAD_MUTEX_UNLOCK(&_starpu_get_worker_struct(workerid)->sched_mutex);
 
 	return 0;
 }