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

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

DEFINITIONS

This source file includes following definitions.
  1. MPIO_Waitsome

   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_Waitsome = PMPIO_Waitsome
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPIO_Waitsome MPIO_Waitsome
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPIO_Waitsome as PMPIO_Waitsome
  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_Waitsome(int count, MPIO_Request requests[], int *outcount,
  32                   int indices[], MPI_Status *statuses)
  33 {
  34     int i, flag, err; 
  35     MPID_THREADPRIV_DECL;
  36 
  37     ROMIO_THREAD_CS_ENTER();
  38 
  39     if (count == 1) {
  40         err = MPIO_Wait( requests, statuses );
  41         if (!err) {
  42             *outcount = 1;
  43             indices[0] = 0;
  44         }
  45         goto fn_exit;
  46     }
  47 
  48     /* Check for no active requests */
  49     for (i=0; i<count; i++) {
  50         if (requests[i] != MPIO_REQUEST_NULL) {
  51             break;
  52         }
  53     }
  54     if (i == count) {
  55         *outcount = MPI_UNDEFINED;
  56         err = MPI_SUCCESS;
  57         goto fn_exit;
  58     }
  59 
  60     err = MPI_SUCCESS;
  61     *outcount = 0;
  62     do {
  63         for (i=0; i<count; i++) {
  64             if (requests[i] != MPIO_REQUEST_NULL) {
  65                 err = MPIO_Test( &requests[i], &flag, statuses );
  66                 if (flag) {
  67                     if (!err) {
  68                         indices[0] = i;
  69                         indices++;
  70                         statuses++;
  71                         *outcount = *outcount + 1;
  72                     }
  73                 }
  74             }
  75         }
  76     } while (*outcount == 0);
  77 
  78 fn_exit:
  79     ROMIO_THREAD_CS_EXIT();
  80     return err;
  81 }

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