Fix NA_Progress() lock release when entering with multiple threads
@@ -1770,8 +1770,10 @@ NA_Progress(na_class_t *na_class, na_context_t *context, unsigned int timeout)
hg_time_t t1, t2;
/* Timeout is 0 so leave */
- if (remaining <= 0)
- goto unlock;
+ if (remaining <= 0) {
+ hg_atomic_decr32(&na_private_context->progressing);
+ goto done;
+ }
hg_time_get_current(&t1);
@@ -1790,8 +1792,11 @@ NA_Progress(na_class_t *na_class, na_context_t *context, unsigned int timeout)
&na_private_context->progress_mutex,
(unsigned int) (remaining * 1000.0)) != HG_UTIL_SUCCESS) {
/* Timeout occurred so leave */
- goto unlock;
+ hg_thread_mutex_unlock(&na_private_context->progress_mutex);
+ hg_atomic_decr32(&na_private_context->progressing);
+ goto done;
}
+ hg_thread_mutex_unlock(&na_private_context->progress_mutex);
hg_time_get_current(&t2);
remaining -= hg_time_to_double(hg_time_subtract(t2, t1));
