root/opal/mca/event/libevent2022/libevent2022_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) 2015      Intel, Inc. All rights reserved.
   8  * Copyright (c) 2017      Research Organization for Information Science
   9  *                         and Technology (RIST). All rights reserved.
  10  * Copyright (c) 2017      IBM Corporation. All rights reserved.
  11  * $COPYRIGHT$
  12  *
  13  * Additional copyrights may follow
  14  */
  15 #include "opal_config.h"
  16 #include "opal/constants.h"
  17 
  18 /* protect common defines */
  19 #undef PACKAGE_BUGREPORT
  20 #undef PACKAGE_NAME
  21 #undef PACKAGE_STRING
  22 #undef PACKAGE_TARNAME
  23 #undef PACKAGE_VERSION
  24 
  25 #include "libevent/config.h"
  26 
  27 
  28 #ifdef HAVE_SYS_TYPES_H
  29 #include <sys/types.h>
  30 #endif
  31 
  32 
  33 #ifdef WIN32
  34 #define WIN32_LEAN_AND_MEAN
  35 #include <windows.h>
  36 #undef WIN32_LEAN_AND_MEAN
  37 #endif
  38 #ifdef HAVE_SYS_TIME_H
  39 #include <sys/time.h>
  40 #endif
  41 #include <sys/queue.h>
  42 #include <stdio.h>
  43 #include <stdlib.h>
  44 #ifndef WIN32
  45 #ifdef HAVE_UNISTD_H
  46 #include <unistd.h>
  47 #endif
  48 #endif
  49 #include <errno.h>
  50 #include <signal.h>
  51 #include <string.h>
  52 #include <assert.h>
  53 #include <time.h>
  54 
  55 #include "opal/class/opal_object.h"
  56 #include "opal/threads/mutex.h"
  57 #include "opal/threads/threads.h"
  58 #include "opal/util/output.h"
  59 #include "opal/util/argv.h"
  60 #include "opal/util/fd.h"
  61 
  62 #include "libevent2022.h"
  63 #include "opal/mca/event/base/base.h"
  64 
  65 #include "libevent/event.h"
  66 #include "libevent/event-internal.h"
  67 
  68 #include "opal/mca/event/event.h"
  69 
  70 static struct event_config *config=NULL;
  71 extern char *ompi_event_module_include;
  72 extern const struct eventop *ompi_eventops[];
  73 
  74 opal_event_base_t* opal_event_base_create(void)
  75 {
  76     opal_event_base_t *base;
  77 
  78     base = event_base_new_with_config(config);
  79     if (NULL == base) {
  80         /* there is no backend method that does what we want */
  81         opal_output(0, "No event method available");
  82     }
  83     return base;
  84 }
  85 
  86 int opal_event_init(void)
  87 {
  88     char **includes=NULL;
  89     bool dumpit=false;
  90     int i, j;
  91 
  92     if (opal_output_get_verbosity(opal_event_base_framework.framework_output) > 4) {
  93         event_enable_debug_mode();
  94         dumpit = true;
  95     }
  96 
  97     if (NULL == ompi_event_module_include) {
  98         /* Shouldn't happen, but... */
  99         ompi_event_module_include = strdup("select");
 100     }
 101     includes = opal_argv_split(ompi_event_module_include,',');
 102 
 103     /* get a configuration object */
 104     config = event_config_new();
 105     /* cycle thru the available subsystems */
 106     for (i = 0 ; NULL != ompi_eventops[i] ; ++i) {
 107         /* if this module isn't included in the given ones,
 108          * then exclude it
 109          */
 110         dumpit = true;
 111         for (j=0; NULL != includes[j]; j++) {
 112             if (0 == strcmp("all", includes[j]) ||
 113                 0 == strcmp(ompi_eventops[i]->name, includes[j])) {
 114                 dumpit = false;
 115                 break;
 116             }
 117         }
 118         if (dumpit) {
 119             event_config_avoid_method(config, ompi_eventops[i]->name);
 120         }
 121     }
 122     opal_argv_free(includes);
 123 
 124     return OPAL_SUCCESS;
 125 }
 126 
 127 int opal_event_finalize(void)
 128 {
 129     event_config_free(config);
 130     return OPAL_SUCCESS;
 131 }
 132 
 133 opal_event_t* opal_event_alloc(void)
 134 {
 135     opal_event_t *ev;
 136 
 137     ev = (opal_event_t*)malloc(sizeof(opal_event_t));
 138     return ev;
 139 }

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