root/opal/mca/event/external/event_external_module.c

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

DEFINITIONS

This source file includes following definitions.
  1. opal_event_base_create
  2. opal_event_init
  3. opal_event_finalize
  4. opal_event_alloc

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2010      Cisco Systems, Inc.  All rights reserved.
   4  * Copyright (c) 2010      Oracle and/or its affiliates.  All rights reserved.
   5  * Copyright (c) 2012-2013 Los Alamos National Security, LLC.
   6  *                         All rights reserved.
   7  * Copyright (c) 2017      Research Organization for Information Science
   8  *                         and Technology (RIST). All rights reserved.
   9  * Copyright (c) 2017      IBM Corporation.  All rights reserved.
  10  */
  11 #include "opal_config.h"
  12 #include "opal/constants.h"
  13 #include "opal/util/output.h"
  14 
  15 #include "opal/mca/event/base/base.h"
  16 #include "external.h"
  17 
  18 #include "opal/util/argv.h"
  19 
  20 extern char *ompi_event_module_include;
  21 static struct event_config *config = NULL;
  22 
  23 opal_event_base_t* opal_event_base_create(void)
  24 {
  25     opal_event_base_t *base;
  26 
  27     base = event_base_new_with_config(config);
  28     if (NULL == base) {
  29         /* there is no backend method that does what we want */
  30         opal_output(0, "No event method available");
  31     }
  32     return base;
  33 }
  34 
  35 int opal_event_init(void)
  36 {
  37     const char **all_available_eventops = NULL;
  38     char **includes=NULL;
  39     bool dumpit=false;
  40     int i, j;
  41 
  42     if (opal_output_get_verbosity(opal_event_base_framework.framework_output) > 4) {
  43         event_enable_debug_mode();
  44     }
  45 
  46     all_available_eventops = event_get_supported_methods();
  47 
  48     if (NULL == ompi_event_module_include) {
  49         /* Shouldn't happen, but... */
  50         ompi_event_module_include = strdup("select");
  51     }
  52     includes = opal_argv_split(ompi_event_module_include,',');
  53 
  54     /* get a configuration object */
  55     config = event_config_new();
  56     /* cycle thru the available subsystems */
  57     for (i = 0 ; NULL != all_available_eventops[i] ; ++i) {
  58         /* if this module isn't included in the given ones,
  59          * then exclude it
  60          */
  61         dumpit = true;
  62         for (j=0; NULL != includes[j]; j++) {
  63             if (0 == strcmp("all", includes[j]) ||
  64                 0 == strcmp(all_available_eventops[i], includes[j])) {
  65                 dumpit = false;
  66                 break;
  67             }
  68         }
  69         if (dumpit) {
  70             event_config_avoid_method(config, all_available_eventops[i]);
  71         }
  72     }
  73     opal_argv_free(includes);
  74 
  75     return OPAL_SUCCESS;
  76 }
  77 
  78 int opal_event_finalize(void)
  79 {
  80     return OPAL_SUCCESS;
  81 }
  82 
  83 opal_event_t* opal_event_alloc(void)
  84 {
  85     opal_event_t *ev;
  86 
  87     ev = (opal_event_t*)malloc(sizeof(opal_event_t));
  88     return ev;
  89 }

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