root/ompi/mca/io/romio321/romio/mpi-io/iotestany.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPIO_Testany

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 2003 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "mpioimpl.h"
   9 
  10 #ifdef HAVE_WEAK_SYMBOLS
  11 
  12 #if defined(HAVE_PRAGMA_WEAK)
  13 #pragma weak MPIO_Testany = PMPIO_Testany
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPIO_Testany MPIO_Testany
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPIO_Testany as PMPIO_Testany
  18 /* end of weak pragmas */
  19 #endif
  20 
  21 /* Include mapping from MPI->PMPI */
  22 #define MPIO_BUILD_PROFILING
  23 #include "mpioprof.h"
  24 #endif
  25 
  26 /*
  27   This is a temporary function until we switch to using MPI-2's generalized
  28   requests.
  29 */
  30 
  31 int MPIO_Testany(int count, MPIO_Request requests[], int *index, 
  32                  int *flag, MPI_Status *status)
  33 {
  34     int i, err; 
  35     MPID_THREADPRIV_DECL;
  36 
  37     ROMIO_THREAD_CS_ENTER();
  38 
  39     if (count == 1) {
  40         err = MPIO_Test( requests, flag, status );
  41         if (!err) *index = 0;
  42         goto fn_exit;
  43     }
  44 
  45     /* Check for no active requests */
  46     for (i=0; i<count; i++) {
  47         if (requests[i] != MPIO_REQUEST_NULL) {
  48             break;
  49         }
  50     }
  51     if (i == count) {
  52         *index = MPI_UNDEFINED;
  53 #ifdef MPICH
  54         /* need to set empty status */
  55         if (status != MPI_STATUS_IGNORE) {
  56             status->MPI_SOURCE = MPI_ANY_SOURCE;
  57             status->MPI_TAG    = MPI_ANY_TAG;
  58             MPIR_STATUS_SET_COUNT(*status, 0);
  59             MPIR_STATUS_SET_CANCEL_BIT(*status, 0);
  60         }
  61 #endif
  62         err = MPI_SUCCESS;
  63         goto fn_exit;
  64     }
  65 
  66     err = MPI_SUCCESS;
  67     for (i=0; i<count; i++) {
  68       if (requests[i] != MPIO_REQUEST_NULL) {
  69         err = MPIO_Test( &requests[i], flag, status );
  70         if (*flag) {
  71           if (!err) *index = i;
  72           break;
  73         }
  74       }
  75     }
  76 
  77 
  78 fn_exit:
  79     ROMIO_THREAD_CS_EXIT();
  80     return err;
  81 }

/* [<][>][^][v][top][bottom][index][help] */