From 0061f2170d48a9d037ac059fd46b78c6537dd3ac Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 27 May 2010 21:37:11 +0000 Subject: [PATCH] ompi/mpi/c/request_get_status.c (MPI_Request_get_status): If opal_progress is called then check the status of the request before returning. opal_progress is called only once. This logic parallels MPI_Test (ompi_request_default_test). Thanks to Shaun Jackman for submitting the patch. This commit was SVN r23215. --- ompi/mpi/c/request_get_status.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ompi/mpi/c/request_get_status.c b/ompi/mpi/c/request_get_status.c index 1f04a76f0d..14d975e49c 100644 --- a/ompi/mpi/c/request_get_status.c +++ b/ompi/mpi/c/request_get_status.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,6 +44,10 @@ static const char FUNC_NAME[] = "MPI_Request_get_status"; int MPI_Request_get_status(MPI_Request request, int *flag, MPI_Status *status) { +#if OPAL_ENABLE_PROGRESS_THREADS == 0 + int do_it_once = 0; +#endif + MEMCHECKER( memchecker_request(&request); ); @@ -60,6 +64,9 @@ int MPI_Request_get_status(MPI_Request request, int *flag, } } +#if OPAL_ENABLE_PROGRESS_THREADS == 0 + recheck_request_status: +#endif opal_atomic_mb(); if( (request == MPI_REQUEST_NULL) || (request->req_state == OMPI_REQUEST_INACTIVE) ) { *flag = true; @@ -81,9 +88,16 @@ int MPI_Request_get_status(MPI_Request request, int *flag, } return MPI_SUCCESS; } - *flag = false; #if OPAL_ENABLE_PROGRESS_THREADS == 0 - opal_progress(); + if( 0 == do_it_once ) { + /* If we run the opal_progress then check the status of the + request before leaving. We will call the opal_progress only + once per call. */ + opal_progress(); + do_it_once++; + goto recheck_request_status; + } #endif + *flag = false; return MPI_SUCCESS; }