root/ompi/message/message.c

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

DEFINITIONS

This source file includes following definitions.
  1. ompi_message_constructor
  2. ompi_message_init
  3. ompi_message_finalize

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2011      Sandia National Laboratories. All rights reserved.
   4  * Copyright (c) 2012      Cisco Systems, Inc.  All rights reserved.
   5  * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
   6  *                         reserved.
   7  * Copyright (c) 2015      Research Organization for Information Science
   8  *                         and Technology (RIST). All rights reserved.
   9  * $COPYRIGHT$
  10  *
  11  * Additional copyrights may follow
  12  *
  13  * $HEADER$
  14  */
  15 
  16 #include "ompi_config.h"
  17 
  18 #include "ompi/constants.h"
  19 
  20 #include "opal/class/opal_object.h"
  21 #include "ompi/message/message.h"
  22 #include "ompi/constants.h"
  23 
  24 static void ompi_message_constructor(ompi_message_t *msg);
  25 
  26 OBJ_CLASS_INSTANCE(ompi_message_t,
  27                    opal_free_list_item_t,
  28                    ompi_message_constructor, NULL);
  29 
  30 opal_free_list_t ompi_message_free_list = {{{0}}};
  31 opal_pointer_array_t  ompi_message_f_to_c_table = {{0}};
  32 
  33 ompi_predefined_message_t ompi_message_null = {{{{{0}}}}};
  34 ompi_predefined_message_t ompi_message_no_proc = {{{{{0}}}}};
  35 
  36 static void ompi_message_constructor(ompi_message_t *msg)
  37 {
  38     msg->comm = NULL;
  39     msg->req_ptr = NULL;
  40     msg->m_f_to_c_index = MPI_UNDEFINED;
  41     msg->count = 0;
  42 }
  43 
  44 int
  45 ompi_message_init(void)
  46 {
  47     int rc;
  48 
  49     OBJ_CONSTRUCT(&ompi_message_free_list, opal_free_list_t);
  50     rc = opal_free_list_init(&ompi_message_free_list,
  51                              sizeof(ompi_message_t), 8,
  52                              OBJ_CLASS(ompi_message_t),
  53                              0, 0, 8, -1, 8, NULL, 0, NULL, NULL, NULL);
  54 
  55     OBJ_CONSTRUCT(&ompi_message_f_to_c_table, opal_pointer_array_t);
  56 
  57     ompi_message_null.message.req_ptr = NULL;
  58     ompi_message_null.message.count = 0;
  59     ompi_message_null.message.m_f_to_c_index =
  60         opal_pointer_array_add(&ompi_message_f_to_c_table, &ompi_message_null);
  61 
  62     OBJ_CONSTRUCT(&ompi_message_no_proc, ompi_message_t);
  63     ompi_message_no_proc.message.m_f_to_c_index =
  64         opal_pointer_array_add(&ompi_message_f_to_c_table,
  65                                &ompi_message_no_proc);
  66     if (1 != ompi_message_no_proc.message.m_f_to_c_index) {
  67         return OMPI_ERR_NOT_FOUND;
  68     }
  69 
  70     return rc;
  71 }
  72 
  73 int
  74 ompi_message_finalize(void)
  75 {
  76     OBJ_DESTRUCT(&ompi_message_no_proc);
  77     OBJ_DESTRUCT(&ompi_message_free_list);
  78     OBJ_DESTRUCT(&ompi_message_f_to_c_table);
  79 
  80     return OMPI_SUCCESS;
  81 }

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