Bladeren bron

port r11390 from 1.1: Do not bother taking the rwlock for testing active_hook_cnt, this is already atomic

Samuel Thibault 11 jaren geleden
bovenliggende
commit
21defdfaa0
1 gewijzigde bestanden met toevoegingen van 2 en 8 verwijderingen
  1. 2 8
      src/core/progress_hook.c

+ 2 - 8
src/core/progress_hook.c

@@ -41,6 +41,7 @@ static int active_hook_cnt = 0;
 void _starpu_init_progression_hooks(void)
 {
 	STARPU_PTHREAD_RWLOCK_INIT(&progression_hook_rwlock, NULL);
+	STARPU_HG_DISABLE_CHECKING(active_hook_cnt);
 }
 
 int starpu_progression_hook_register(unsigned (*func)(void *arg), void *arg)
@@ -85,14 +86,7 @@ void starpu_progression_hook_deregister(int hook_id)
 
 unsigned _starpu_execute_registered_progression_hooks(void)
 {
-	/* If there is no hook registered, we short-cut loop. */
-	if (STARPU_PTHREAD_RWLOCK_TRYRDLOCK(&progression_hook_rwlock))
-		/* It is busy, do not bother */
-		return;
-	int no_hook = (active_hook_cnt == 0);
-	STARPU_PTHREAD_RWLOCK_UNLOCK(&progression_hook_rwlock);
-
-	if (no_hook)
+	if (active_hook_cnt == 0)
 		return 1;
 
 	/* By default, it is possible to block, but if some progression hooks