root/opal/mca/event/base/event_base_frame.c

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

DEFINITIONS

This source file includes following definitions.
  1. opal_event_base_open
  2. opal_event_base_close

   1 /*
   2  * Copyright (c) 2010-2015 Cisco Systems, Inc.  All rights reserved.
   3  * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
   4  * Copyright (c) 2017      Research Organization for Information Science
   5  *                         and Technology (RIST). All rights reserved.
   6  * $COPYRIGHT$
   7  *
   8  * Additional copyrights may follow
   9  *
  10  * $HEADER$
  11  */
  12 
  13 
  14 #include "opal_config.h"
  15 
  16 #include "opal/constants.h"
  17 #include "opal/util/output.h"
  18 #include "opal/mca/mca.h"
  19 #include "opal/mca/base/base.h"
  20 
  21 #include "opal/mca/event/event.h"
  22 #include "opal/mca/event/base/base.h"
  23 
  24 
  25 /*
  26  * The following file was created by configure.  It contains extern
  27  * statements and the definition of an array of pointers to each
  28  * component's public mca_base_component_t struct.
  29  */
  30 #include "opal/mca/event/base/static-components.h"
  31 
  32 /**
  33  * Initialize the event MCA framework
  34  *
  35  * @retval OPAL_SUCCESS Upon success
  36  * @retval OPAL_ERROR Upon failure
  37  *
  38  * This must be the first function invoked in the event MCA
  39  * framework.  It initializes the event MCA framework, finds
  40  * and opens event components, etc.
  41  *
  42  * This function is invoked during opal_init().
  43  *
  44  * This function fills in the internal global variable
  45  * opal_event_base_components_opened, which is a list of all
  46  * event components that were successfully opened.  This
  47  * variable should \em only be used by other event base
  48  * functions -- it is not considered a public interface member --
  49  * and is only mentioned here for completeness.
  50  */
  51 static int opal_event_base_open(mca_base_open_flag_t flags);
  52 static int opal_event_base_close(void);
  53 
  54 /* Use default register and close function */
  55 MCA_BASE_FRAMEWORK_DECLARE(opal, event, NULL, NULL, opal_event_base_open,
  56                            opal_event_base_close, mca_event_base_static_components,
  57                            0);
  58 
  59 /*
  60  * Globals
  61  */
  62 opal_event_base_t *opal_sync_event_base=NULL;
  63 
  64 static int opal_event_base_open(mca_base_open_flag_t flags)
  65 {
  66     int rc = OPAL_SUCCESS;
  67 
  68     /* Silence compiler warning */
  69     (void) flags;
  70 
  71     /* no need to open the components since we only use one */
  72 
  73     /* init the lib */
  74     if (OPAL_SUCCESS != (rc = opal_event_init())) {
  75         return rc;
  76     }
  77 
  78     /* Declare our intent to use threads */
  79     opal_event_use_threads();
  80 
  81     /* get our event base */
  82     if (NULL == (opal_sync_event_base = opal_event_base_create())) {
  83         return OPAL_ERROR;
  84     }
  85 
  86     /* set the number of priorities */
  87     if (0 < OPAL_EVENT_NUM_PRI) {
  88         opal_event_base_priority_init(opal_sync_event_base, OPAL_EVENT_NUM_PRI);
  89     }
  90 
  91     return rc;
  92 }
  93 
  94 static int opal_event_base_close(void)
  95 {
  96     int rc;
  97     
  98     /* cleanup components even though they are statically opened */
  99     if (OPAL_SUCCESS != (rc =mca_base_framework_components_close (&opal_event_base_framework,
 100                                                                   NULL))) {
 101         return rc;
 102     }
 103 
 104     opal_event_base_free(opal_sync_event_base);
 105 
 106     /* finalize the lib */
 107     return opal_event_finalize();
 108 
 109 }
 110 

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