Skip to content

Commit

Permalink
only signal condition idle transition
Browse files Browse the repository at this point in the history
- this is a performance optimization; it should greatly reduce calls to
  cond_signal without any change in functionality
  • Loading branch information
carns committed Sep 5, 2024
1 parent 8ee65d5 commit 00dbd38
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/margo-prio-pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ static void pool_push(ABT_pool pool, ABT_unit unit)
queue_push(&p_pool->high_prio_queue, p_unit);
}
p_pool->num++;
pthread_cond_signal(&p_pool->cond);
/* only signal on the transition from empty to non-empty; in other cases
* there will be no one waiting on the condition.
*/
if (p_pool->num == 1) pthread_cond_signal(&p_pool->cond);
pthread_mutex_unlock(&p_pool->mutex);
}

Expand Down

0 comments on commit 00dbd38

Please sign in to comment.