Explorar o código

While removing a tag, protect the hierarchical table on the one hand, and the
tag structure itself on the other hand.

Cédric Augonnet %!s(int64=17) %!d(string=hai) anos
pai
achega
841dee46ef
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      src/core/dependencies/tags.c

+ 6 - 1
src/core/dependencies/tags.c

@@ -86,14 +86,19 @@ void starpu_tag_remove(starpu_tag_t id)
 	struct tag_s *tag;
 
 	take_mutex(&tag_mutex);
+
 	tag = htbl_remove_tag(tag_htbl, id);
+
+	release_mutex(&tag_mutex);
+
+	take_mutex(&tag->lock);
 	
 #ifdef DYNAMIC_DEPS_SIZE
 	if (tag)
 		free(tag->succ);
 #endif
 
-	release_mutex(&tag_mutex);
+	release_mutex(&tag->lock);
 
 	free(tag);
 }