1
1

Fix the bug #315. If there are multiple threads waiting for a free_list item

then use broadcast in order to wake them up. If there is only one then use signal
(which is supposed to be faster) and of course if there are no threads
waiting then just continue.

This commit was SVN r12049.
Этот коммит содержится в:
George Bosilca 2006-10-06 16:17:50 +00:00
родитель cda46efd2a
Коммит 2411ad74e4

Просмотреть файл

@ -177,7 +177,11 @@ static inline int __ompi_free_list_wait( ompi_free_list_t* fl,
if(ompi_free_list_grow((fl), (fl)->fl_num_per_alloc)
== OMPI_SUCCESS) {
if( 0 < (fl)->fl_num_waiting ) {
opal_condition_broadcast(&((fl)->fl_condition));
if( 1 == (fl)->fl_num_waiting ) {
opal_condition_signal(&((fl)->fl_condition));
} else {
opal_condition_broadcast(&((fl)->fl_condition));
}
}
} else {
(fl)->fl_num_waiting++;
@ -215,7 +219,11 @@ static inline int __ompi_free_list_wait( ompi_free_list_t* fl,
if( &(fl)->super.opal_lifo_ghost == original ) { \
OPAL_THREAD_LOCK(&(fl)->fl_lock); \
if((fl)->fl_num_waiting > 0) { \
opal_condition_signal(&((fl)->fl_condition)); \
if( 1 == (fl)->fl_num_waiting ) { \
opal_condition_signal(&((fl)->fl_condition)); \
} else { \
opal_condition_broadcast(&((fl)->fl_condition)); \
} \
} \
OPAL_THREAD_UNLOCK(&(fl)->fl_lock); \
} \