-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/pt2pt/test.c
        -:    0:Graph:test.gcno
        -:    0:Data:test.gcda
        -:    0:Runs:916
        -:    0:Programs:305
        -:    1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
        -:    2:/*
        -:    3: *
        -:    4: *  (C) 2001 by Argonne National Laboratory.
        -:    5: *      See COPYRIGHT in top-level directory.
        -:    6: */
        -:    7:
        -:    8:#include "mpiimpl.h"
        -:    9:
        -:   10:/* -- Begin Profiling Symbol Block for routine MPI_Test */
        -:   11:#if defined(HAVE_PRAGMA_WEAK)
        -:   12:#pragma weak MPI_Test = PMPI_Test
        -:   13:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
        -:   14:#pragma _HP_SECONDARY_DEF PMPI_Test  MPI_Test
        -:   15:#elif defined(HAVE_PRAGMA_CRI_DUP)
        -:   16:#pragma _CRI duplicate MPI_Test as PMPI_Test
        -:   17:#endif
        -:   18:/* -- End Profiling Symbol Block */
        -:   19:
        -:   20:/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
        -:   21:   the MPI routines */
        -:   22:#ifndef MPICH_MPI_FROM_PMPI
        -:   23:#undef MPI_Test
        -:   24:#define MPI_Test PMPI_Test
        -:   25:
        -:   26:#endif
        -:   27:
        -:   28:#undef FUNCNAME
        -:   29:#define FUNCNAME MPI_Test
        -:   30:
        -:   31:/*@
        -:   32:    MPI_Test  - Tests for the completion of a request
        -:   33:
        -:   34:Input Parameter:
        -:   35:. request - MPI request (handle) 
        -:   36:
        -:   37:Output Parameter:
        -:   38:+ flag - true if operation completed (logical) 
        -:   39:- status - status object (Status).  May be 'MPI_STATUS_IGNORE'.
        -:   40:
        -:   41:.N ThreadSafe
        -:   42:
        -:   43:.N waitstatus
        -:   44:
        -:   45:.N Fortran
        -:   46:
        -:   47:.N FortranStatus
        -:   48:
        -:   49:.N Errors
        -:   50:.N MPI_SUCCESS
        -:   51:.N MPI_ERR_REQUEST
        -:   52:.N MPI_ERR_ARG
        -:   53:@*/
        -:   54:int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status)
        -:   56:    static const char FCNAME[] = "MPI_Test";
        -:   58:    int active_flag;
        -:   61:    MPID_MPI_STATE_DECL(MPID_STATE_MPI_TEST);
        -:   62:
        -:   64:    
        -:   66:    MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_TEST);
        -:   67:
        -:   68:    /* Validate parameters, especially handles needing to be converted */
        -:   69:#   ifdef HAVE_ERROR_CHECKING
        -:   70:    {
        -:   71:        MPID_BEGIN_ERROR_CHECKS;
        -:   72:        {
        -:   75:	    
        -:   78:	}
        -:   79:        MPID_END_ERROR_CHECKS;
        -:   80:    }
        -:   81:#   endif /* HAVE_ERROR_CHECKING */
        -:   82:    
        -:   83:    /* Convert MPI object handles to object pointers */
        -:   85:    
        -:   86:    /* Validate parameters and objects (post conversion) */
        -:   87:#   ifdef HAVE_ERROR_CHECKING
        -:   88:    {
        -:   89:        MPID_BEGIN_ERROR_CHECKS;
        -:   90:        {
        -:   92:	    { 
        -:   93:		/* Validate request_ptr */
        -:   95:	    }
        -:   96:	    
        -:   98:	    /* NOTE: MPI_STATUS_IGNORE != NULL */
        -:  100:	    
        -:  102:        }
        -:  103:        MPID_END_ERROR_CHECKS;
        -:  104:    }
        -:  105:#   endif /* HAVE_ERROR_CHECKING */
        -:  106:
        -:  107:    /* ... body of routine ...  */
        -:  108:    
        -:  109:    /* If this is a null request handle, then return an empty status */
        -:  111:    {
      469:  112:	MPIR_Status_set_empty(status);
      469:  113:	*flag = TRUE;
      469:  114:	goto fn_exit;
        -:  115:    }
        -:  116:    
        -:  118:
        -:  119:    /* If the request is already completed AND we want to avoid calling
        -:  120:     the progress engine, we could make the call to MPID_Progress_test
        -:  121:     conditional on the request not being completed. */
        -:  124:
        -:  126:    {
    #####:  127:	mpi_errno = (request_ptr->poll_fn)(request_ptr->grequest_extra_state, 
        -:  128:			status);
    #####:  129:	if (mpi_errno != MPI_SUCCESS) goto fn_fail;
        -:  130:    }
        -:  131:    
        -:  133:    {
   219801:  134:	mpi_errno = MPIR_Request_complete(request, request_ptr, status, 
        -:  135:					  &active_flag);
   219801:  136:	*flag = TRUE;
   219801:  137:	if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
        -:  138:	/* Fall through to the exit */
        -:  139:    }
        -:  140:
        -:  141:    /* ... end of body of routine ... */
        -:  142:    
        -:  144:	MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_TEST);
        -:  147:    
        1:  148:  fn_fail:
        -:  149:    /* --BEGIN ERROR HANDLING-- */
        -:  150:#   ifdef HAVE_ERROR_CHECKING
        -:  151:    {
        1:  152:	mpi_errno = MPIR_Err_create_code(
        -:  153:	    mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, 
        -:  154:	    "**mpi_test",
        -:  155:	    "**mpi_test %p %p %p", request, flag, status);
        -:  156:    }
        -:  157:#   endif
        1:  158:    mpi_errno = MPIR_Err_return_comm(request_ptr ? request_ptr->comm : NULL, 
        -:  159:				     FCNAME, mpi_errno);
        1:  160:    goto fn_exit;
        -:  161:    /* --END ERROR HANDLING-- */
        -:  162:}