@@ -35,7 +35,7 @@ int ompi_request_default_test(ompi_request_t ** rptr,
3535#if OPAL_ENABLE_PROGRESS_THREADS == 0
3636 int do_it_once = 0 ;
3737
38- recheck_request_status :
38+ recheck_request_status :
3939#endif
4040 opal_atomic_mb ();
4141 if ( request -> req_state == OMPI_REQUEST_INACTIVE ) {
@@ -86,9 +86,10 @@ int ompi_request_default_test(ompi_request_t ** rptr,
8686 * If we run the opal_progress then check the status of the request before
8787 * leaving. We will call the opal_progress only once per call.
8888 */
89- opal_progress ();
90- do_it_once ++ ;
91- goto recheck_request_status ;
89+ ++ do_it_once ;
90+ if (0 != opal_progress ()) {
91+ goto recheck_request_status ;
92+ }
9293 }
9394#endif
9495 * completed = false;
@@ -183,15 +184,15 @@ int ompi_request_default_test_all(
183184 ompi_request_t * * rptr ;
184185 size_t num_completed = 0 ;
185186 ompi_request_t * request ;
187+ int do_it_once = 0 ;
186188
187189 opal_atomic_mb ();
188- rptr = requests ;
189- for (i = 0 ; i < count ; i ++ , rptr ++ ) {
190- request = * rptr ;
190+ for (i = 0 ; i < count ; i ++ ) {
191+ request = requests [i ];
191192
192- if ( request -> req_state == OMPI_REQUEST_INACTIVE ||
193- REQUEST_COMPLETE (request ) ) {
193+ if ( request -> req_state == OMPI_REQUEST_INACTIVE || REQUEST_COMPLETE (request ) ) {
194194 num_completed ++ ;
195+ continue ;
195196 }
196197#if OPAL_ENABLE_FT_MPI
197198 /* Check for dead requests due to process failure */
@@ -206,13 +207,22 @@ int ompi_request_default_test_all(
206207 return MPI_ERR_PROC_FAILED_PENDING ;
207208 }
208209#endif /* OPAL_ENABLE_FT_MPI */
210+ #if OPAL_ENABLE_PROGRESS_THREADS == 0
211+ if (0 == do_it_once ) {
212+ ++ do_it_once ;
213+ if (0 != opal_progress ()) {
214+ /* continue walking the list, retest the current request */
215+ -- i ;
216+ continue ;
217+ }
218+ }
219+ #endif /* OPAL_ENABLE_PROGRESS_THREADS */
220+ /* short-circuit */
221+ break ;
209222 }
210223
211224 if (num_completed != count ) {
212225 * completed = false;
213- #if OPAL_ENABLE_PROGRESS_THREADS == 0
214- opal_progress ();
215- #endif
216226 return OMPI_SUCCESS ;
217227 }
218228
@@ -318,6 +328,7 @@ int ompi_request_default_test_some(
318328 }
319329 if ( REQUEST_COMPLETE (request ) ) {
320330 indices [num_requests_done ++ ] = i ;
331+ continue ;
321332 }
322333#if OPAL_ENABLE_FT_MPI
323334 /* Check for dead requests due to process failure */
0 commit comments