@@ -290,24 +290,24 @@ opal_common_ucx_wpool_progress(opal_common_ucx_wpool_t *wpool)
290
290
/* Go over all active workers and progress them
291
291
* TODO: may want to have some partitioning to progress only part of
292
292
* workers */
293
- opal_mutex_lock (& wpool -> mutex );
294
- OPAL_LIST_FOREACH_SAFE (item , next , & wpool -> active_workers ,
295
- _winfo_list_item_t ) {
296
- opal_common_ucx_winfo_t * winfo = item -> ptr ;
297
- opal_mutex_lock (& winfo -> mutex );
298
- if ( OPAL_UNLIKELY (winfo -> released ) ) {
299
- /* Do garbage collection of worker info's if needed */
300
- opal_list_remove_item (& wpool -> active_workers , & item -> super );
301
- _winfo_reset (winfo );
302
- opal_list_append (& wpool -> idle_workers , & item -> super );
303
- } else {
304
- /* Progress worker until there are existing events */
305
- while (ucp_worker_progress (winfo -> worker ));
293
+ if (!opal_mutex_trylock (& wpool -> mutex )) {
294
+ OPAL_LIST_FOREACH_SAFE (item , next , & wpool -> active_workers ,
295
+ _winfo_list_item_t ) {
296
+ opal_common_ucx_winfo_t * winfo = item -> ptr ;
297
+ opal_mutex_lock (& winfo -> mutex );
298
+ if ( OPAL_UNLIKELY (winfo -> released ) ) {
299
+ /* Do garbage collection of worker info's if needed */
300
+ opal_list_remove_item (& wpool -> active_workers , & item -> super );
301
+ _winfo_reset (winfo );
302
+ opal_list_append (& wpool -> idle_workers , & item -> super );
303
+ } else {
304
+ /* Progress worker until there are existing events */
305
+ while (ucp_worker_progress (winfo -> worker ));
306
+ }
307
+ opal_mutex_unlock (& winfo -> mutex );
306
308
}
307
- opal_mutex_unlock (& winfo -> mutex );
309
+ opal_mutex_unlock (& wpool -> mutex );
308
310
}
309
-
310
- opal_mutex_unlock (& wpool -> mutex );
311
311
}
312
312
313
313
static int
0 commit comments