1
1

* rename ompi_event to opal_event

This commit was SVN r6328.
Этот коммит содержится в:
Brian Barrett 2005-07-03 23:09:55 +00:00
родитель 39dbeeedfb
Коммит 23b687b0f4
95 изменённых файлов: 920 добавлений и 920 удалений

Просмотреть файл

@ -19,7 +19,7 @@
#include <stdio.h> #include <stdio.h>
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/mca.h" #include "mca/mca.h"
#include "mca/base/base.h" #include "mca/base/base.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
@ -33,7 +33,7 @@ int mca_btl_base_close(void)
mca_btl_base_selected_module_t *sm; mca_btl_base_selected_module_t *sm;
/* disable event processing while cleaning up btls */ /* disable event processing while cleaning up btls */
ompi_event_disable(); opal_event_disable();
/* Finalize all the btl components and free their list items */ /* Finalize all the btl components and free their list items */
@ -65,7 +65,7 @@ int mca_btl_base_close(void)
free(mca_btl_base_exclude); free(mca_btl_base_exclude);
/* restore event processing */ /* restore event processing */
ompi_event_enable(); opal_event_enable();
/* All done */ /* All done */
return OMPI_SUCCESS; return OMPI_SUCCESS;

Просмотреть файл

@ -28,7 +28,7 @@
/* Open MPI includes */ /* Open MPI includes */
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "mca/btl/base/base.h" #include "mca/btl/base/base.h"

Просмотреть файл

@ -18,7 +18,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "gm_config.h" #include "gm_config.h"
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -18,7 +18,7 @@
#define MCA_BTL_GM_ENDPOINT_H #define MCA_BTL_GM_ENDPOINT_H
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "btl_gm_frag.h" #include "btl_gm_frag.h"

Просмотреть файл

@ -27,7 +27,7 @@
/* Open MPI includes */ /* Open MPI includes */
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "util/output.h" #include "util/output.h"
@ -68,10 +68,10 @@ struct mca_btl_mvapi_component_t {
opal_list_t ib_procs; opal_list_t ib_procs;
/**< list of ib proc structures */ /**< list of ib proc structures */
ompi_event_t ib_send_event; opal_event_t ib_send_event;
/**< event structure for sends */ /**< event structure for sends */
ompi_event_t ib_recv_event; opal_event_t ib_recv_event;
/**< event structure for recvs */ /**< event structure for recvs */
opal_mutex_t ib_lock; opal_mutex_t ib_lock;

Просмотреть файл

@ -17,7 +17,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -18,7 +18,7 @@
#define MCA_BTL_IB_ENDPOINT_H #define MCA_BTL_IB_ENDPOINT_H
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "btl_mvapi_frag.h" #include "btl_mvapi_frag.h"

Просмотреть файл

@ -27,7 +27,7 @@
/* Open MPI includes */ /* Open MPI includes */
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "util/output.h" #include "util/output.h"
@ -68,10 +68,10 @@ struct mca_btl_openib_component_t {
opal_list_t ib_procs; opal_list_t ib_procs;
/**< list of ib proc structures */ /**< list of ib proc structures */
ompi_event_t ib_send_event; opal_event_t ib_send_event;
/**< event structure for sends */ /**< event structure for sends */
ompi_event_t ib_recv_event; opal_event_t ib_recv_event;
/**< event structure for recvs */ /**< event structure for recvs */
opal_mutex_t ib_lock; opal_mutex_t ib_lock;

Просмотреть файл

@ -17,7 +17,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -18,7 +18,7 @@
#define MCA_BTL_IB_ENDPOINT_H #define MCA_BTL_IB_ENDPOINT_H
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "btl_openib_frag.h" #include "btl_openib_frag.h"

Просмотреть файл

@ -26,7 +26,7 @@
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "class/ompi_fifo.h" #include "class/ompi_fifo.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "mca/btl/base/base.h" #include "mca/btl/base/base.h"

Просмотреть файл

@ -24,7 +24,7 @@
#include "include/constants.h" #include "include/constants.h"
#include "include/sys/cache.h" #include "include/sys/cache.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -20,7 +20,7 @@
#define MCA_BTL_SELF_ENDPOINT_H #define MCA_BTL_SELF_ENDPOINT_H
#if OMPI_ENABLE_PROGRESS_THREADS == 1 #if OMPI_ENABLE_PROGRESS_THREADS == 1
#include "event/event.h" #include "opal/event/event.h"
#endif #endif
/** /**

Просмотреть файл

@ -27,7 +27,7 @@
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "class/ompi_fifo.h" #include "class/ompi_fifo.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "mca/btl/base/base.h" #include "mca/btl/base/base.h"

Просмотреть файл

@ -24,7 +24,7 @@
#include "include/constants.h" #include "include/constants.h"
#include "include/sys/cache.h" #include "include/sys/cache.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -20,7 +20,7 @@
#define MCA_BTL_SM_ENDPOINT_H #define MCA_BTL_SM_ENDPOINT_H
#if OMPI_ENABLE_PROGRESS_THREADS == 1 #if OMPI_ENABLE_PROGRESS_THREADS == 1
#include "event/event.h" #include "opal/event/event.h"
#endif #endif
/** /**

Просмотреть файл

@ -27,7 +27,7 @@
/* Open MPI includes */ /* Open MPI includes */
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "mca/btl/base/base.h" #include "mca/btl/base/base.h"

Просмотреть файл

@ -17,7 +17,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -18,7 +18,7 @@
#define MCA_BTL_TEMPLATE_ENDPOINT_H #define MCA_BTL_TEMPLATE_ENDPOINT_H
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"
#include "btl_template_frag.h" #include "btl_template_frag.h"

Просмотреть файл

@ -23,7 +23,7 @@
#include <gm.h> #include <gm.h>
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/mpool/mpool.h" #include "mca/mpool/mpool.h"
#include "mca/allocator/allocator.h" #include "mca/allocator/allocator.h"

Просмотреть файл

@ -21,7 +21,7 @@
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/mpool/mpool.h" #include "mca/mpool/mpool.h"
#include "mca/allocator/allocator.h" #include "mca/allocator/allocator.h"
#include "mca/common/vapi/vapi_mem_reg.h" #include "mca/common/vapi/vapi_mem_reg.h"

Просмотреть файл

@ -21,7 +21,7 @@
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/mpool/mpool.h" #include "mca/mpool/mpool.h"
#include "mca/allocator/allocator.h" #include "mca/allocator/allocator.h"
#include "mca/common/vapi/vapi_mem_reg.h" #include "mca/common/vapi/vapi_mem_reg.h"

Просмотреть файл

@ -21,7 +21,7 @@
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/mpool/mpool.h" #include "mca/mpool/mpool.h"
#include "mca/allocator/allocator.h" #include "mca/allocator/allocator.h"
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)

Просмотреть файл

@ -10,7 +10,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "event/event.h" #include "opal/event/event.h"
#include "pml_example.h" #include "pml_example.h"
#include "mca/base/mca_base_param.h" #include "mca/base/mca_base_param.h"

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "include/sys/cache.h" #include "include/sys/cache.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mpi.h" #include "mpi.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/btl/btl.h" #include "mca/btl/btl.h"

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mpi.h" #include "mpi.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"

Просмотреть файл

@ -16,7 +16,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mpi.h" #include "mpi.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"

Просмотреть файл

@ -19,7 +19,7 @@
#include <stdio.h> #include <stdio.h>
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/mca.h" #include "mca/mca.h"
#include "mca/base/base.h" #include "mca/base/base.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
@ -33,7 +33,7 @@ int mca_ptl_base_close(void)
mca_ptl_base_selected_module_t *sm; mca_ptl_base_selected_module_t *sm;
/* disable event processing while cleaning up ptls */ /* disable event processing while cleaning up ptls */
ompi_event_disable(); opal_event_disable();
/* Finalize all the ptl components and free their list items */ /* Finalize all the ptl components and free their list items */
@ -65,7 +65,7 @@ int mca_ptl_base_close(void)
free(mca_ptl_base_exclude); free(mca_ptl_base_exclude);
/* restore event processing */ /* restore event processing */
ompi_event_enable(); opal_event_enable();
/* All done */ /* All done */
return OMPI_SUCCESS; return OMPI_SUCCESS;

Просмотреть файл

@ -23,7 +23,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"

Просмотреть файл

@ -25,7 +25,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "constants.h" #include "constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -23,7 +23,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
#include "ptl_elan_frag.h" #include "ptl_elan_frag.h"

Просмотреть файл

@ -26,7 +26,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "constants.h" #include "constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -20,7 +20,7 @@
#ifndef PTL_PROF_H_HAS_BEEN_INCLUDED #ifndef PTL_PROF_H_HAS_BEEN_INCLUDED
#define PTL_PROF_H_HAS_BEEN_INCLUDED #define PTL_PROF_H_HAS_BEEN_INCLUDED
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
#include "mca/pml/base/pml_base_recvreq.h" #include "mca/pml/base/pml_base_recvreq.h"

Просмотреть файл

@ -25,7 +25,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "constants.h" #include "constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -36,7 +36,7 @@
#include "include/constants.h" #include "include/constants.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"
#include "datatype/datatype.h" #include "datatype/datatype.h"

Просмотреть файл

@ -21,7 +21,7 @@
#define PTL_SELF_H_HAS_BEEN_INCLUDED #define PTL_SELF_H_HAS_BEEN_INCLUDED
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
#include "mca/ptl/base/ptl_base_sendreq.h" #include "mca/ptl/base/ptl_base_sendreq.h"

Просмотреть файл

@ -35,7 +35,7 @@
#endif #endif
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -26,7 +26,7 @@
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "class/ompi_bitmap.h" #include "class/ompi_bitmap.h"
#include "class/ompi_fifo.h" #include "class/ompi_fifo.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
#include "mca/mpool/mpool.h" #include "mca/mpool/mpool.h"

Просмотреть файл

@ -24,7 +24,7 @@
#include "include/constants.h" #include "include/constants.h"
#include "include/sys/cache.h" #include "include/sys/cache.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"

Просмотреть файл

@ -20,7 +20,7 @@
#define MCA_PTL_SM_PEER_H #define MCA_PTL_SM_PEER_H
#if OMPI_ENABLE_PROGRESS_THREADS == 1 #if OMPI_ENABLE_PROGRESS_THREADS == 1
#include "event/event.h" #include "opal/event/event.h"
#endif #endif
/** /**

Просмотреть файл

@ -30,7 +30,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "class/ompi_free_list.h" #include "class/ompi_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
@ -63,8 +63,8 @@ struct mca_ptl_tcp_component_t {
opal_list_t tcp_pending_acks; /**< list of pending acks - retry as sends complete */ opal_list_t tcp_pending_acks; /**< list of pending acks - retry as sends complete */
opal_list_t tcp_events; /**< list of pending events */ opal_list_t tcp_events; /**< list of pending events */
struct mca_ptl_tcp_proc_t* tcp_local; /**< the tcp proc instance corresponding to the local process */ struct mca_ptl_tcp_proc_t* tcp_local; /**< the tcp proc instance corresponding to the local process */
ompi_event_t tcp_send_event; /**< event structure for sends */ opal_event_t tcp_send_event; /**< event structure for sends */
ompi_event_t tcp_recv_event; /**< event structure for recvs */ opal_event_t tcp_recv_event; /**< event structure for recvs */
opal_mutex_t tcp_lock; /**< lock for accessing module state */ opal_mutex_t tcp_lock; /**< lock for accessing module state */
}; };
typedef struct mca_ptl_tcp_component_t mca_ptl_tcp_component_t; typedef struct mca_ptl_tcp_component_t mca_ptl_tcp_component_t;

Просмотреть файл

@ -34,7 +34,7 @@
#endif #endif
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/if.h" #include "util/if.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"
@ -64,7 +64,7 @@
struct mca_ptl_tcp_event_t { struct mca_ptl_tcp_event_t {
opal_list_item_t item; opal_list_item_t item;
ompi_event_t event; opal_event_t event;
}; };
typedef struct mca_ptl_tcp_event_t mca_ptl_tcp_event_t; typedef struct mca_ptl_tcp_event_t mca_ptl_tcp_event_t;
@ -252,7 +252,7 @@ int mca_ptl_tcp_component_close(void)
free(mca_ptl_tcp_component.tcp_ptl_modules); free(mca_ptl_tcp_component.tcp_ptl_modules);
if (mca_ptl_tcp_component.tcp_listen_sd >= 0) { if (mca_ptl_tcp_component.tcp_listen_sd >= 0) {
ompi_event_del(&mca_ptl_tcp_component.tcp_recv_event); opal_event_del(&mca_ptl_tcp_component.tcp_recv_event);
close(mca_ptl_tcp_component.tcp_listen_sd); close(mca_ptl_tcp_component.tcp_listen_sd);
mca_ptl_tcp_component.tcp_listen_sd = -1; mca_ptl_tcp_component.tcp_listen_sd = -1;
} }
@ -263,7 +263,7 @@ int mca_ptl_tcp_component_close(void)
item != NULL; item != NULL;
item = opal_list_remove_first(&mca_ptl_tcp_component.tcp_events)) { item = opal_list_remove_first(&mca_ptl_tcp_component.tcp_events)) {
mca_ptl_tcp_event_t* event = (mca_ptl_tcp_event_t*)item; mca_ptl_tcp_event_t* event = (mca_ptl_tcp_event_t*)item;
ompi_event_del(&event->event); opal_event_del(&event->event);
OBJ_RELEASE(event); OBJ_RELEASE(event);
} }
OPAL_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock); OPAL_THREAD_UNLOCK(&mca_ptl_tcp_component.tcp_lock);
@ -442,10 +442,10 @@ static int mca_ptl_tcp_component_create_listen(void)
} }
/* register listen port */ /* register listen port */
ompi_event_set( opal_event_set(
&mca_ptl_tcp_component.tcp_recv_event, &mca_ptl_tcp_component.tcp_recv_event,
mca_ptl_tcp_component.tcp_listen_sd, mca_ptl_tcp_component.tcp_listen_sd,
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
mca_ptl_tcp_component_recv_handler, mca_ptl_tcp_component_recv_handler,
0); 0);
return OMPI_SUCCESS; return OMPI_SUCCESS;
@ -537,12 +537,12 @@ int mca_ptl_tcp_component_control(int param, void* value, size_t size)
switch(param) { switch(param) {
case MCA_PTL_ENABLE: case MCA_PTL_ENABLE:
if(*(int*)value) { if(*(int*)value) {
ompi_event_add(&mca_ptl_tcp_component.tcp_recv_event, 0); opal_event_add(&mca_ptl_tcp_component.tcp_recv_event, 0);
if(opal_hash_table_get_size(&mca_ptl_tcp_component.tcp_procs) > 0) { if(opal_hash_table_get_size(&mca_ptl_tcp_component.tcp_procs) > 0) {
opal_progress_events(OMPI_EVLOOP_NONBLOCK); opal_progress_events(OPAL_EVLOOP_NONBLOCK);
} }
} else { } else {
ompi_event_del(&mca_ptl_tcp_component.tcp_recv_event); opal_event_del(&mca_ptl_tcp_component.tcp_recv_event);
} }
break; break;
default: default:
@ -589,8 +589,8 @@ static void mca_ptl_tcp_component_accept(void)
/* wait for receipt of peers process identifier to complete this connection */ /* wait for receipt of peers process identifier to complete this connection */
event = OBJ_NEW(mca_ptl_tcp_event_t); event = OBJ_NEW(mca_ptl_tcp_event_t);
ompi_event_set(&event->event, sd, OMPI_EV_READ, mca_ptl_tcp_component_recv_handler, event); opal_event_set(&event->event, sd, OPAL_EV_READ, mca_ptl_tcp_component_recv_handler, event);
ompi_event_add(&event->event, 0); opal_event_add(&event->event, 0);
} }
} }

Просмотреть файл

@ -169,16 +169,16 @@ static void mca_ptl_tcp_peer_dump(mca_ptl_base_peer_t* ptl_peer, const char* msg
static inline void mca_ptl_tcp_peer_event_init(mca_ptl_base_peer_t* ptl_peer, int sd) static inline void mca_ptl_tcp_peer_event_init(mca_ptl_base_peer_t* ptl_peer, int sd)
{ {
ompi_event_set( opal_event_set(
&ptl_peer->peer_recv_event, &ptl_peer->peer_recv_event,
ptl_peer->peer_sd, ptl_peer->peer_sd,
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
mca_ptl_tcp_peer_recv_handler, mca_ptl_tcp_peer_recv_handler,
ptl_peer); ptl_peer);
ompi_event_set( opal_event_set(
&ptl_peer->peer_send_event, &ptl_peer->peer_send_event,
ptl_peer->peer_sd, ptl_peer->peer_sd,
OMPI_EV_WRITE|OMPI_EV_PERSIST, OPAL_EV_WRITE|OPAL_EV_PERSIST,
mca_ptl_tcp_peer_send_handler, mca_ptl_tcp_peer_send_handler,
ptl_peer); ptl_peer);
} }
@ -214,14 +214,14 @@ int mca_ptl_tcp_peer_send(mca_ptl_base_peer_t* ptl_peer, mca_ptl_tcp_send_frag_t
return rc; return rc;
} else { } else {
ptl_peer->peer_send_frag = frag; ptl_peer->peer_send_frag = frag;
ompi_event_add(&ptl_peer->peer_send_event, 0); opal_event_add(&ptl_peer->peer_send_event, 0);
} }
} else { } else {
/* after the first fragment - delay sending subsequent fragments to /* after the first fragment - delay sending subsequent fragments to
* enable better overlap by the scheduler * enable better overlap by the scheduler
*/ */
ptl_peer->peer_send_frag = frag; ptl_peer->peer_send_frag = frag;
ompi_event_add(&ptl_peer->peer_send_event, 0); opal_event_add(&ptl_peer->peer_send_event, 0);
} }
break; break;
case MCA_PTL_TCP_SHUTDOWN: case MCA_PTL_TCP_SHUTDOWN:
@ -310,7 +310,7 @@ bool mca_ptl_tcp_peer_accept(mca_ptl_base_peer_t* ptl_peer, struct sockaddr_in*
return false; return false;
} }
mca_ptl_tcp_peer_event_init(ptl_peer, sd); mca_ptl_tcp_peer_event_init(ptl_peer, sd);
ompi_event_add(&ptl_peer->peer_recv_event, 0); opal_event_add(&ptl_peer->peer_recv_event, 0);
mca_ptl_tcp_peer_connected(ptl_peer); mca_ptl_tcp_peer_connected(ptl_peer);
#if OMPI_ENABLE_DEBUG && WANT_PEER_DUMP #if OMPI_ENABLE_DEBUG && WANT_PEER_DUMP
mca_ptl_tcp_peer_dump(ptl_peer, "accepted"); mca_ptl_tcp_peer_dump(ptl_peer, "accepted");
@ -335,8 +335,8 @@ bool mca_ptl_tcp_peer_accept(mca_ptl_base_peer_t* ptl_peer, struct sockaddr_in*
void mca_ptl_tcp_peer_close(mca_ptl_base_peer_t* ptl_peer) void mca_ptl_tcp_peer_close(mca_ptl_base_peer_t* ptl_peer)
{ {
if(ptl_peer->peer_sd >= 0) { if(ptl_peer->peer_sd >= 0) {
ompi_event_del(&ptl_peer->peer_recv_event); opal_event_del(&ptl_peer->peer_recv_event);
ompi_event_del(&ptl_peer->peer_send_event); opal_event_del(&ptl_peer->peer_send_event);
close(ptl_peer->peer_sd); close(ptl_peer->peer_sd);
ptl_peer->peer_sd = -1; ptl_peer->peer_sd = -1;
} }
@ -369,7 +369,7 @@ static void mca_ptl_tcp_peer_connected(mca_ptl_base_peer_t* ptl_peer)
if(NULL == ptl_peer->peer_send_frag) if(NULL == ptl_peer->peer_send_frag)
ptl_peer->peer_send_frag = (mca_ptl_tcp_send_frag_t*) ptl_peer->peer_send_frag = (mca_ptl_tcp_send_frag_t*)
opal_list_remove_first(&ptl_peer->peer_frags); opal_list_remove_first(&ptl_peer->peer_frags);
ompi_event_add(&ptl_peer->peer_send_event, 0); opal_event_add(&ptl_peer->peer_send_event, 0);
} }
} }
@ -515,7 +515,7 @@ static int mca_ptl_tcp_peer_start_connect(mca_ptl_base_peer_t* ptl_peer)
IMPORTANT_WINDOWS_COMMENT(); IMPORTANT_WINDOWS_COMMENT();
if(ompi_socket_errno == EINPROGRESS || ompi_socket_errno == EWOULDBLOCK) { if(ompi_socket_errno == EINPROGRESS || ompi_socket_errno == EWOULDBLOCK) {
ptl_peer->peer_state = MCA_PTL_TCP_CONNECTING; ptl_peer->peer_state = MCA_PTL_TCP_CONNECTING;
ompi_event_add(&ptl_peer->peer_send_event, 0); opal_event_add(&ptl_peer->peer_send_event, 0);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
mca_ptl_tcp_peer_close(ptl_peer); mca_ptl_tcp_peer_close(ptl_peer);
@ -526,7 +526,7 @@ static int mca_ptl_tcp_peer_start_connect(mca_ptl_base_peer_t* ptl_peer)
/* send our globally unique process identifier to the peer */ /* send our globally unique process identifier to the peer */
if((rc = mca_ptl_tcp_peer_send_connect_ack(ptl_peer)) == OMPI_SUCCESS) { if((rc = mca_ptl_tcp_peer_send_connect_ack(ptl_peer)) == OMPI_SUCCESS) {
ptl_peer->peer_state = MCA_PTL_TCP_CONNECT_ACK; ptl_peer->peer_state = MCA_PTL_TCP_CONNECT_ACK;
ompi_event_add(&ptl_peer->peer_recv_event, 0); opal_event_add(&ptl_peer->peer_recv_event, 0);
} else { } else {
mca_ptl_tcp_peer_close(ptl_peer); mca_ptl_tcp_peer_close(ptl_peer);
} }
@ -546,7 +546,7 @@ static void mca_ptl_tcp_peer_complete_connect(mca_ptl_base_peer_t* ptl_peer)
ompi_socklen_t so_length = sizeof(so_error); ompi_socklen_t so_length = sizeof(so_error);
/* unregister from receiving event notifications */ /* unregister from receiving event notifications */
ompi_event_del(&ptl_peer->peer_send_event); opal_event_del(&ptl_peer->peer_send_event);
/* check connect completion status */ /* check connect completion status */
if(getsockopt(ptl_peer->peer_sd, SOL_SOCKET, SO_ERROR, (char *)&so_error, &so_length) < 0) { if(getsockopt(ptl_peer->peer_sd, SOL_SOCKET, SO_ERROR, (char *)&so_error, &so_length) < 0) {
@ -556,7 +556,7 @@ static void mca_ptl_tcp_peer_complete_connect(mca_ptl_base_peer_t* ptl_peer)
} }
IMPORTANT_WINDOWS_COMMENT(); IMPORTANT_WINDOWS_COMMENT();
if(so_error == EINPROGRESS || so_error == EWOULDBLOCK) { if(so_error == EINPROGRESS || so_error == EWOULDBLOCK) {
ompi_event_add(&ptl_peer->peer_send_event, 0); opal_event_add(&ptl_peer->peer_send_event, 0);
return; return;
} }
if(so_error != 0) { if(so_error != 0) {
@ -567,7 +567,7 @@ static void mca_ptl_tcp_peer_complete_connect(mca_ptl_base_peer_t* ptl_peer)
if(mca_ptl_tcp_peer_send_connect_ack(ptl_peer) == OMPI_SUCCESS) { if(mca_ptl_tcp_peer_send_connect_ack(ptl_peer) == OMPI_SUCCESS) {
ptl_peer->peer_state = MCA_PTL_TCP_CONNECT_ACK; ptl_peer->peer_state = MCA_PTL_TCP_CONNECT_ACK;
ompi_event_add(&ptl_peer->peer_recv_event, 0); opal_event_add(&ptl_peer->peer_recv_event, 0);
} else { } else {
mca_ptl_tcp_peer_close(ptl_peer); mca_ptl_tcp_peer_close(ptl_peer);
} }
@ -658,14 +658,14 @@ static void mca_ptl_tcp_peer_send_handler(int sd, short flags, void* user)
/* if nothing else to do unregister for send event notifications */ /* if nothing else to do unregister for send event notifications */
if(NULL == ptl_peer->peer_send_frag) { if(NULL == ptl_peer->peer_send_frag) {
ompi_event_del(&ptl_peer->peer_send_event); opal_event_del(&ptl_peer->peer_send_event);
} }
break; break;
} }
default: default:
ompi_output(0, "mca_ptl_tcp_peer_send_handler: invalid connection state (%d)", ompi_output(0, "mca_ptl_tcp_peer_send_handler: invalid connection state (%d)",
ptl_peer->peer_state); ptl_peer->peer_state);
ompi_event_del(&ptl_peer->peer_send_event); opal_event_del(&ptl_peer->peer_send_event);
break; break;
} }
OPAL_THREAD_UNLOCK(&ptl_peer->peer_send_lock); OPAL_THREAD_UNLOCK(&ptl_peer->peer_send_lock);

Просмотреть файл

@ -29,7 +29,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/pml/pml.h" #include "mca/pml/pml.h"
#include "mca/ptl/ptl.h" #include "mca/ptl/ptl.h"
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)
@ -69,8 +69,8 @@ struct mca_ptl_base_peer_t {
opal_list_t peer_frags; /**< list of pending frags to send */ opal_list_t peer_frags; /**< list of pending frags to send */
opal_mutex_t peer_send_lock; /**< lock for concurrent access to peer state */ opal_mutex_t peer_send_lock; /**< lock for concurrent access to peer state */
opal_mutex_t peer_recv_lock; /**< lock for concurrent access to peer state */ opal_mutex_t peer_recv_lock; /**< lock for concurrent access to peer state */
ompi_event_t peer_send_event; /**< event for async processing of send frags */ opal_event_t peer_send_event; /**< event for async processing of send frags */
ompi_event_t peer_recv_event; /**< event for async processing of recv frags */ opal_event_t peer_recv_event; /**< event for async processing of recv frags */
bool peer_nbo; /**< convert headers to network byte order? */ bool peer_nbo; /**< convert headers to network byte order? */
}; };
typedef struct mca_ptl_base_peer_t mca_ptl_base_peer_t; typedef struct mca_ptl_base_peer_t mca_ptl_base_peer_t;

Просмотреть файл

@ -28,7 +28,7 @@
#include "mca/ns/ns.h" #include "mca/ns/ns.h"
#include "mca/rmgr/rmgr.h" #include "mca/rmgr/rmgr.h"
#include "event/event.h" #include "opal/event/event.h"
#if HAVE_SIGNAL_H #if HAVE_SIGNAL_H
#include <signal.h> #include <signal.h>
@ -108,8 +108,8 @@ ompi_mpi_abort(struct ompi_communicator_t* comm,
is actually dead. But just in case there are some is actually dead. But just in case there are some
race conditions, keep progressing the event loop until race conditions, keep progressing the event loop until
we get killed */ we get killed */
if (!OMPI_ENABLE_PROGRESS_THREADS || ompi_event_progress_thread()) { if (!OMPI_ENABLE_PROGRESS_THREADS || opal_event_progress_thread()) {
ompi_event_loop(0); opal_event_loop(0);
} else { } else {
sleep(1000); sleep(1000);
} }

Просмотреть файл

@ -21,7 +21,7 @@
#include "mca/schema/schema.h" #include "mca/schema/schema.h"
#include "mpi.h" #include "mpi.h"
#include "event/event.h" #include "opal/event/event.h"
#include "group/group.h" #include "group/group.h"
#include "errhandler/errcode.h" #include "errhandler/errcode.h"
#include "errhandler/errclass.h" #include "errhandler/errclass.h"
@ -63,7 +63,7 @@ int ompi_mpi_finalize(void)
ompi_mpi_finalized = true; ompi_mpi_finalized = true;
#if OMPI_ENABLE_PROGRESS_THREADS == 0 #if OMPI_ENABLE_PROGRESS_THREADS == 0
opal_progress_events(OMPI_EVLOOP_NONBLOCK); opal_progress_events(OPAL_EVLOOP_NONBLOCK);
#endif #endif
/* Change progress function priority back to RTE level stuff */ /* Change progress function priority back to RTE level stuff */

Просмотреть файл

@ -404,7 +404,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
/* BWB - is this still needed? */ /* BWB - is this still needed? */
#if OMPI_ENABLE_PROGRESS_THREADS == 0 #if OMPI_ENABLE_PROGRESS_THREADS == 0
opal_progress_events(OMPI_EVLOOP_NONBLOCK); opal_progress_events(OPAL_EVLOOP_NONBLOCK);
#endif #endif
/* Second barrier -- wait for message from /* Second barrier -- wait for message from

Просмотреть файл

@ -337,7 +337,7 @@
#define OMPI_ENABLE_MPI_PROFILING 1 #define OMPI_ENABLE_MPI_PROFILING 1
/* Do we want to use the event library signal handlers */ /* Do we want to use the event library signal handlers */
#define OMPI_EVENT_USE_SIGNALS 1 #define OPAL_EVENT_USE_SIGNALS 1
/* OMPI underlying F90 compiler */ /* OMPI underlying F90 compiler */
#define OMPI_WANT_F90_BINDINGS 0 #define OMPI_WANT_F90_BINDINGS 0

Просмотреть файл

@ -47,12 +47,12 @@
#include "event/compat/sys/queue.h" #include "event/compat/sys/queue.h"
#include "event/compat/err.h" #include "event/compat/err.h"
#include "event/event.h" #include "opal/event/event.h"
extern struct ompi_event_list ompi_timequeue; extern struct opal_event_list ompi_timequeue;
extern struct ompi_event_list ompi_eventqueue; extern struct opal_event_list opal_eventqueue;
extern struct ompi_event_list ompi_addqueue; extern struct opal_event_list ompi_addqueue;
extern struct ompi_event_list ompi_signalqueue; extern struct opal_event_list opal_signalqueue;
#define NEVENT 64 #define NEVENT 64
@ -66,12 +66,12 @@ void signal_process(void);
int signal_recalc(void); int signal_recalc(void);
void *win32_init (void); void *win32_init (void);
int win32_insert (void *, struct ompi_event *); int win32_insert (void *, struct opal_event *);
int win32_del (void *, struct ompi_event *); int win32_del (void *, struct opal_event *);
int win32_recalc (void *, int); int win32_recalc (void *, int);
int win32_dispatch (void *, struct timeval *); int win32_dispatch (void *, struct timeval *);
struct ompi_eventop ompi_win32ops = { struct opal_eventop opal_win32ops = {
"win32", "win32",
win32_init, win32_init,
win32_insert, win32_insert,
@ -88,7 +88,7 @@ static int timeval_to_ms(struct timeval *tv)
void * void *
win32_init(void) win32_init(void)
{ {
return (&ompi_win32ops); return (&opal_win32ops);
} }
int int
@ -98,13 +98,13 @@ win32_recalc(void *arg, int max)
} }
int int
win32_insert(struct win32op *wop, struct ompi_event *ev) win32_insert(struct win32op *wop, struct opal_event *ev)
{ {
if (ev->ev_events & OMPI_EV_SIGNAL) { if (ev->ev_events & OPAL_EV_SIGNAL) {
if (ev->ev_events & (OMPI_EV_READ|OMPI_EV_WRITE)) if (ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE))
errx(1, "%s: OMPI_EV_SIGNAL incompatible use", errx(1, "%s: OPAL_EV_SIGNAL incompatible use",
__FUNCTION__); __FUNCTION__);
if((int)signal(OMPI_EVENT_SIGNAL(ev), signal_handler) == -1) if((int)signal(OPAL_EVENT_SIGNAL(ev), signal_handler) == -1)
return (-1); return (-1);
return (0); return (0);
@ -118,10 +118,10 @@ win32_dispatch(void *arg, struct timeval *tv)
{ {
int res = 0; int res = 0;
struct win32op *wop = arg; struct win32op *wop = arg;
struct ompi_event *ev; struct opal_event *ev;
int evres; int evres;
TAILQ_FOREACH(ev, &ompi_eventqueue, ev_next) { TAILQ_FOREACH(ev, &opal_eventqueue, ev_next) {
res = WaitForSingleObject(ev->ev_fd, timeval_to_ms(tv)); res = WaitForSingleObject(ev->ev_fd, timeval_to_ms(tv));
if(res == WAIT_TIMEOUT || res == WAIT_FAILED) { if(res == WAIT_TIMEOUT || res == WAIT_FAILED) {
@ -131,15 +131,15 @@ win32_dispatch(void *arg, struct timeval *tv)
signal_process(); signal_process();
evres = 0; evres = 0;
if(ev->ev_events & OMPI_EV_READ) if(ev->ev_events & OPAL_EV_READ)
evres |= OMPI_EV_READ; evres |= OPAL_EV_READ;
if(ev->ev_events & OMPI_EV_WRITE) if(ev->ev_events & OPAL_EV_WRITE)
evres |= OMPI_EV_WRITE; evres |= OPAL_EV_WRITE;
if(evres) { if(evres) {
if(!(ev->ev_events & OMPI_EV_PERSIST)) if(!(ev->ev_events & OPAL_EV_PERSIST))
ompi_event_del(ev); opal_event_del(ev);
ompi_event_active(ev, evres, 1); opal_event_active(ev, evres, 1);
} }
} }
@ -150,9 +150,9 @@ win32_dispatch(void *arg, struct timeval *tv)
} }
int int
win32_del(struct win32op *arg, struct ompi_event *ev) win32_del(struct win32op *arg, struct opal_event *ev)
{ {
return ((int)signal(OMPI_EVENT_SIGNAL(ev), SIG_IGN)); return ((int)signal(OPAL_EVENT_SIGNAL(ev), SIG_IGN));
} }
static int signal_handler(int sig) static int signal_handler(int sig)
@ -166,11 +166,11 @@ static int signal_handler(int sig)
int int
signal_recalc(void) signal_recalc(void)
{ {
struct ompi_event *ev; struct opal_event *ev;
/* Reinstall our signal handler. */ /* Reinstall our signal handler. */
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) { TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
if((int)signal(OMPI_EVENT_SIGNAL(ev), signal_handler) == -1) if((int)signal(OPAL_EVENT_SIGNAL(ev), signal_handler) == -1)
return (-1); return (-1);
} }
return (0); return (0);
@ -179,15 +179,15 @@ signal_recalc(void)
void void
signal_process(void) signal_process(void)
{ {
struct ompi_event *ev; struct opal_event *ev;
short ncalls; short ncalls;
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) { TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
ncalls = evsigcaught[OMPI_EVENT_SIGNAL(ev)]; ncalls = evsigcaught[OPAL_EVENT_SIGNAL(ev)];
if (ncalls) { if (ncalls) {
if (!(ev->ev_events & OMPI_EV_PERSIST)) if (!(ev->ev_events & OPAL_EV_PERSIST))
ompi_event_del(ev); opal_event_del(ev);
ompi_event_active(ev, OMPI_EV_SIGNAL, ncalls); opal_event_active(ev, OPAL_EV_SIGNAL, ncalls);
} }
} }

Просмотреть файл

@ -63,16 +63,16 @@
#include "evsignal.h" #include "evsignal.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
extern struct ompi_event_list ompi_eventqueue; extern struct opal_event_list opal_eventqueue;
extern volatile sig_atomic_t ompi_evsignal_caught; extern volatile sig_atomic_t opal_evsignal_caught;
extern opal_mutex_t ompi_event_lock; extern opal_mutex_t opal_event_lock;
/* due to limitations in the epoll interface, we need to keep track of /* due to limitations in the epoll interface, we need to keep track of
* all file descriptors outself. * all file descriptors outself.
*/ */
struct evepoll { struct evepoll {
struct ompi_event *evread; struct opal_event *evread;
struct ompi_event *evwrite; struct opal_event *evwrite;
}; };
struct epollop { struct epollop {
@ -85,12 +85,12 @@ struct epollop {
} epollop; } epollop;
static void *epoll_init (void); static void *epoll_init (void);
static int epoll_add (void *, struct ompi_event *); static int epoll_add (void *, struct opal_event *);
static int epoll_del (void *, struct ompi_event *); static int epoll_del (void *, struct opal_event *);
static int epoll_recalc (void *, int); static int epoll_recalc (void *, int);
static int epoll_dispatch (void *, struct timeval *); static int epoll_dispatch (void *, struct timeval *);
struct ompi_eventop ompi_epollops = { struct opal_eventop opal_epollops = {
"epoll", "epoll",
epoll_init, epoll_init,
epoll_add, epoll_add,
@ -139,7 +139,7 @@ epoll_init(void)
} }
epollop.nfds = nfiles; epollop.nfds = nfiles;
ompi_evsignal_init(&epollop.evsigmask); opal_evsignal_init(&epollop.evsigmask);
return (&epollop); return (&epollop);
} }
@ -167,7 +167,7 @@ epoll_recalc(void *arg, int max)
epollop->nfds = nfds; epollop->nfds = nfds;
} }
return (ompi_evsignal_recalc(&epollop->evsigmask)); return (opal_evsignal_recalc(&epollop->evsigmask));
} }
int int
@ -178,19 +178,19 @@ epoll_dispatch(void *arg, struct timeval *tv)
struct evepoll *evep; struct evepoll *evep;
int i, res, timeout; int i, res, timeout;
if (ompi_evsignal_deliver(&epollop->evsigmask) == -1) if (opal_evsignal_deliver(&epollop->evsigmask) == -1)
return (-1); return (-1);
timeout = tv->tv_sec * 1000 + tv->tv_usec / 1000; timeout = tv->tv_sec * 1000 + tv->tv_usec / 1000;
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
res = epoll_wait(epollop->epfd, events, epollop->nevents, timeout); res = epoll_wait(epollop->epfd, events, epollop->nevents, timeout);
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
} else { } else {
res = epoll_wait(epollop->epfd, events, epollop->nevents, timeout); res = epoll_wait(epollop->epfd, events, epollop->nevents, timeout);
} }
if (ompi_evsignal_recalc(&epollop->evsigmask) == -1) if (opal_evsignal_recalc(&epollop->evsigmask) == -1)
return (-1); return (-1);
if (res == -1) { if (res == -1) {
@ -199,17 +199,17 @@ epoll_dispatch(void *arg, struct timeval *tv)
return (-1); return (-1);
} }
ompi_evsignal_process(); opal_evsignal_process();
return (0); return (0);
} else if (ompi_evsignal_caught) } else if (opal_evsignal_caught)
ompi_evsignal_process(); opal_evsignal_process();
LOG_DBG((LOG_MISC, 80, "%s: epoll_wait reports %d", __func__, res)); LOG_DBG((LOG_MISC, 80, "%s: epoll_wait reports %d", __func__, res));
for (i = 0; i < res; i++) { for (i = 0; i < res; i++) {
int which = 0; int which = 0;
int what = events[i].events; int what = events[i].events;
struct ompi_event *evread = NULL, *evwrite = NULL; struct opal_event *evread = NULL, *evwrite = NULL;
evep = (struct evepoll *)events[i].data.ptr; evep = (struct evepoll *)events[i].data.ptr;
@ -220,27 +220,27 @@ epoll_dispatch(void *arg, struct timeval *tv)
if (what & EPOLLIN) { if (what & EPOLLIN) {
evread = evep->evread; evread = evep->evread;
which |= OMPI_EV_READ; which |= OPAL_EV_READ;
} }
if (what & EPOLLOUT) { if (what & EPOLLOUT) {
evwrite = evep->evwrite; evwrite = evep->evwrite;
which |= OMPI_EV_WRITE; which |= OPAL_EV_WRITE;
} }
if (!which) if (!which)
continue; continue;
if (evread != NULL && !(evread->ev_events & OMPI_EV_PERSIST)) if (evread != NULL && !(evread->ev_events & OPAL_EV_PERSIST))
ompi_event_del_i(evread); opal_event_del_i(evread);
if (evwrite != NULL && evwrite != evread && if (evwrite != NULL && evwrite != evread &&
!(evwrite->ev_events & OMPI_EV_PERSIST)) !(evwrite->ev_events & OPAL_EV_PERSIST))
ompi_event_del_i(evwrite); opal_event_del_i(evwrite);
if (evread != NULL) if (evread != NULL)
ompi_event_active_i(evread, OMPI_EV_READ, 1); opal_event_active_i(evread, OPAL_EV_READ, 1);
if (evwrite != NULL) if (evwrite != NULL)
ompi_event_active_i(evwrite, OMPI_EV_WRITE, 1); opal_event_active_i(evwrite, OPAL_EV_WRITE, 1);
} }
return (0); return (0);
@ -248,15 +248,15 @@ epoll_dispatch(void *arg, struct timeval *tv)
static int static int
epoll_add(void *arg, struct ompi_event *ev) epoll_add(void *arg, struct opal_event *ev)
{ {
struct epollop *epollop = arg; struct epollop *epollop = arg;
struct epoll_event epev; struct epoll_event epev;
struct evepoll *evep; struct evepoll *evep;
int fd, op, events; int fd, op, events;
if (ev->ev_events & OMPI_EV_SIGNAL) if (ev->ev_events & OPAL_EV_SIGNAL)
return (ompi_evsignal_add(&epollop->evsigmask, ev)); return (opal_evsignal_add(&epollop->evsigmask, ev));
fd = ev->ev_fd; fd = ev->ev_fd;
if (fd >= epollop->nfds) { if (fd >= epollop->nfds) {
@ -276,9 +276,9 @@ epoll_add(void *arg, struct ompi_event *ev)
op = EPOLL_CTL_MOD; op = EPOLL_CTL_MOD;
} }
if (ev->ev_events & OMPI_EV_READ) if (ev->ev_events & OPAL_EV_READ)
events |= EPOLLIN; events |= EPOLLIN;
if (ev->ev_events & OMPI_EV_WRITE) if (ev->ev_events & OPAL_EV_WRITE)
events |= EPOLLOUT; events |= EPOLLOUT;
epev.data.ptr = evep; epev.data.ptr = evep;
@ -287,16 +287,16 @@ epoll_add(void *arg, struct ompi_event *ev)
return (-1); return (-1);
/* Update events responsible */ /* Update events responsible */
if (ev->ev_events & OMPI_EV_READ) if (ev->ev_events & OPAL_EV_READ)
evep->evread = ev; evep->evread = ev;
if (ev->ev_events & OMPI_EV_WRITE) if (ev->ev_events & OPAL_EV_WRITE)
evep->evwrite = ev; evep->evwrite = ev;
return (0); return (0);
} }
static int static int
epoll_del(void *arg, struct ompi_event *ev) epoll_del(void *arg, struct opal_event *ev)
{ {
struct epollop *epollop = arg; struct epollop *epollop = arg;
struct epoll_event epev; struct epoll_event epev;
@ -304,8 +304,8 @@ epoll_del(void *arg, struct ompi_event *ev)
int fd, events, op; int fd, events, op;
int needwritedelete = 1, needreaddelete = 1; int needwritedelete = 1, needreaddelete = 1;
if (ev->ev_events & OMPI_EV_SIGNAL) if (ev->ev_events & OPAL_EV_SIGNAL)
return (ompi_evsignal_del(&epollop->evsigmask, ev)); return (opal_evsignal_del(&epollop->evsigmask, ev));
fd = ev->ev_fd; fd = ev->ev_fd;
if (fd >= epollop->nfds) if (fd >= epollop->nfds)
@ -315,9 +315,9 @@ epoll_del(void *arg, struct ompi_event *ev)
op = EPOLL_CTL_DEL; op = EPOLL_CTL_DEL;
events = 0; events = 0;
if (ev->ev_events & OMPI_EV_READ) if (ev->ev_events & OPAL_EV_READ)
events |= EPOLLIN; events |= EPOLLIN;
if (ev->ev_events & OMPI_EV_WRITE) if (ev->ev_events & OPAL_EV_WRITE)
events |= EPOLLOUT; events |= EPOLLOUT;
if ((events & (EPOLLIN|EPOLLOUT)) != (EPOLLIN|EPOLLOUT)) { if ((events & (EPOLLIN|EPOLLOUT)) != (EPOLLIN|EPOLLOUT)) {

Просмотреть файл

@ -67,19 +67,19 @@
#include "util/output.h" #include "util/output.h"
#if defined(HAVE_SELECT) && HAVE_SELECT #if defined(HAVE_SELECT) && HAVE_SELECT
extern const struct ompi_eventop ompi_selectops; extern const struct opal_eventop opal_selectops;
#endif #endif
#if defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL #if defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL
extern const struct ompi_eventop ompi_pollops; extern const struct opal_eventop opal_pollops;
#endif #endif
#if defined(HAVE_RTSIG) && HAVE_RTSIG #if defined(HAVE_RTSIG) && HAVE_RTSIG
extern const struct ompi_eventop ompi_rtsigops; extern const struct opal_eventop opal_rtsigops;
#endif #endif
#if defined(HAVE_EPOLL) && HAVE_EPOLL #if defined(HAVE_EPOLL) && HAVE_EPOLL
extern const struct ompi_eventop ompi_epollops; extern const struct opal_eventop opal_epollops;
#endif #endif
#if defined(HAVE_WORKING_KQUEUE) && HAVE_WORKING_KQUEUE #if defined(HAVE_WORKING_KQUEUE) && HAVE_WORKING_KQUEUE
extern const struct ompi_eventop ompi_kqops; extern const struct opal_eventop opal_kqops;
#endif #endif
#if 0 #if 0
/* This is to prevent event library from picking up the win32_ops since this will /* This is to prevent event library from picking up the win32_ops since this will
@ -87,28 +87,28 @@ extern const struct ompi_eventop ompi_kqops;
PTL as is. Otherwise, there would have to be a lot of magic to be done to get PTL as is. Otherwise, there would have to be a lot of magic to be done to get
this to work */ this to work */
#if defined(WIN32) && WIN32 #if defined(WIN32) && WIN32
extern const struct ompi_eventop ompi_win32ops; extern const struct opal_eventop opal_win32ops;
#endif #endif
#endif #endif
/* In order of preference */ /* In order of preference */
static const struct ompi_eventop *ompi_eventops[] = { static const struct opal_eventop *opal_eventops[] = {
#if 0 #if 0
#if HAVE_WORKING_KQUEUE #if HAVE_WORKING_KQUEUE
&ompi_kqops, &opal_kqops,
#endif #endif
#if HAVE_EPOLL #if HAVE_EPOLL
&ompi_epollops, &opal_epollops,
#endif #endif
#if HAVE_RTSIG #if HAVE_RTSIG
&ompi_rtsigops, &opal_rtsigops,
#endif #endif
#endif #endif
#if defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL #if defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL
&ompi_pollops, &opal_pollops,
#endif #endif
#if defined(HAVE_SELECT) && HAVE_SELECT #if defined(HAVE_SELECT) && HAVE_SELECT
&ompi_selectops, &opal_selectops,
#endif #endif
#if 0 #if 0
/* This is to prevent event library from picking up the win32_ops since this will /* This is to prevent event library from picking up the win32_ops since this will
@ -116,56 +116,56 @@ static const struct ompi_eventop *ompi_eventops[] = {
PTL as is. Otherwise, there would have to be a lot of magic to be done to get PTL as is. Otherwise, there would have to be a lot of magic to be done to get
this to work */ this to work */
#if defined(WIN32) && WIN32 #if defined(WIN32) && WIN32
&ompi_win32ops, &opal_win32ops,
#endif #endif
#endif #endif
NULL NULL
}; };
const struct ompi_eventop *ompi_evsel; const struct opal_eventop *opal_evsel;
void *ompi_evbase; void *opal_evbase;
/* Handle signals */ /* Handle signals */
int (*ompi_event_sigcb)(void); /* Signal callback when gotsig is set */ int (*opal_event_sigcb)(void); /* Signal callback when gotsig is set */
int ompi_event_gotsig; /* Set in signal handler */ int opal_event_gotsig; /* Set in signal handler */
/* Prototypes */ /* Prototypes */
static void ompi_event_process_active(void); static void opal_event_process_active(void);
static void ompi_timeout_correct(struct timeval *off); static void opal_timeout_correct(struct timeval *off);
static void ompi_timeout_insert(struct ompi_event *); static void opal_timeout_insert(struct opal_event *);
static void ompi_event_queue_insert(struct ompi_event *, int); static void opal_event_queue_insert(struct opal_event *, int);
static void ompi_event_queue_remove(struct ompi_event *, int); static void opal_event_queue_remove(struct opal_event *, int);
static void ompi_timeout_process(void); static void opal_timeout_process(void);
int ompi_event_haveevents(void); int opal_event_haveevents(void);
bool ompi_event_progress_thread(void); bool opal_event_progress_thread(void);
extern int ompi_evsignal_restart(void); extern int opal_evsignal_restart(void);
static RB_HEAD(ompi_event_tree, ompi_event) ompi_timetree; static RB_HEAD(opal_event_tree, opal_event) opal_timetree;
static struct ompi_event_list ompi_activequeue; static struct opal_event_list opal_activequeue;
struct ompi_event_list ompi_signalqueue; struct opal_event_list opal_signalqueue;
struct ompi_event_list ompi_eventqueue; struct opal_event_list opal_eventqueue;
static struct timeval ompi_event_tv; static struct timeval opal_event_tv;
OMPI_DECLSPEC opal_mutex_t ompi_event_lock; OMPI_DECLSPEC opal_mutex_t opal_event_lock;
static int ompi_event_inited = 0; static int opal_event_inited = 0;
static bool ompi_event_enabled = false; static bool opal_event_enabled = false;
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
static opal_thread_t ompi_event_thread; static opal_thread_t opal_event_thread;
static ompi_event_t ompi_event_pipe_event; static opal_event_t opal_event_pipe_event;
static int ompi_event_pipe[2]; static int opal_event_pipe[2];
static int ompi_event_pipe_signalled; static int opal_event_pipe_signalled;
#endif #endif
bool ompi_event_progress_thread(void) bool opal_event_progress_thread(void)
{ {
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
return opal_using_threads() ? opal_thread_self_compare(&ompi_event_thread) : true; return opal_using_threads() ? opal_thread_self_compare(&opal_event_thread) : true;
#else #else
return true; return true;
#endif #endif
} }
static int static int
compare(struct ompi_event *a, struct ompi_event *b) compare(struct opal_event *a, struct opal_event *b)
{ {
if (timercmp(&a->ev_timeout, &b->ev_timeout, <)) if (timercmp(&a->ev_timeout, &b->ev_timeout, <))
return (-1); return (-1);
@ -174,20 +174,20 @@ compare(struct ompi_event *a, struct ompi_event *b)
return (0); return (0);
} }
static RB_PROTOTYPE(ompi_event_tree, ompi_event, ev_timeout_node, compare) static RB_PROTOTYPE(opal_event_tree, opal_event, ev_timeout_node, compare)
static RB_GENERATE(ompi_event_tree, ompi_event, ev_timeout_node, compare) static RB_GENERATE(opal_event_tree, opal_event, ev_timeout_node, compare)
#if 0 #if 0
/* Open MPI: JMS As far as I can tell, this function is not used /* Open MPI: JMS As far as I can tell, this function is not used
anywhere */ anywhere */
static int ompi_timeout_next(struct timeval *tv) static int opal_timeout_next(struct timeval *tv)
{ {
struct timeval dflt = OMPI_TIMEOUT_DEFAULT; struct timeval dflt = OPAL_TIMEOUT_DEFAULT;
struct timeval now; struct timeval now;
struct ompi_event *ev; struct opal_event *ev;
if ((ev = RB_MIN(ompi_event_tree, &ompi_timetree)) == NULL) { if ((ev = RB_MIN(opal_event_tree, &opal_timetree)) == NULL) {
*tv = dflt; *tv = dflt;
return(0); return(0);
} }
@ -207,69 +207,69 @@ static int ompi_timeout_next(struct timeval *tv)
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
/* run loop for dispatch thread */ /* run loop for dispatch thread */
static void* ompi_event_run(opal_object_t* arg) static void* opal_event_run(opal_object_t* arg)
{ {
/* Open MPI: Prevent compiler warnings about unused variables */ /* Open MPI: Prevent compiler warnings about unused variables */
#if defined(NDEBUG) #if defined(NDEBUG)
ompi_event_loop(0); opal_event_loop(0);
#else #else
int rc = ompi_event_loop(0); int rc = opal_event_loop(0);
assert(rc >= 0); assert(rc >= 0);
#endif #endif
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
ompi_event_del_i(&ompi_event_pipe_event); opal_event_del_i(&opal_event_pipe_event);
close(ompi_event_pipe[0]); close(opal_event_pipe[0]);
close(ompi_event_pipe[1]); close(opal_event_pipe[1]);
ompi_event_pipe[0] = -1; opal_event_pipe[0] = -1;
ompi_event_pipe[1] = -1; opal_event_pipe[1] = -1;
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
#endif #endif
return NULL; return NULL;
} }
#endif /* OMPI_ENABLE_PROGRESS_THREADS */ #endif /* OMPI_ENABLE_PROGRESS_THREADS */
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
static void ompi_event_pipe_handler(int sd, short flags, void* user) static void opal_event_pipe_handler(int sd, short flags, void* user)
{ {
unsigned char byte; unsigned char byte;
if(read(sd, &byte, 1) < 0) { if(read(sd, &byte, 1) < 0) {
ompi_output(0, "ompi_event_pipe: read failed with: errno=%d\n", errno); ompi_output(0, "opal_event_pipe: read failed with: errno=%d\n", errno);
ompi_event_del(&ompi_event_pipe_event); opal_event_del(&opal_event_pipe_event);
} }
} }
#endif #endif
int int
ompi_event_init(void) opal_event_init(void)
{ {
int i; int i;
if(ompi_event_inited++ != 0) if(opal_event_inited++ != 0)
return OMPI_SUCCESS; return OMPI_SUCCESS;
ompi_event_sigcb = NULL; opal_event_sigcb = NULL;
ompi_event_gotsig = 0; opal_event_gotsig = 0;
gettimeofday(&ompi_event_tv, NULL); gettimeofday(&opal_event_tv, NULL);
OBJ_CONSTRUCT(&ompi_event_lock, opal_mutex_t); OBJ_CONSTRUCT(&opal_event_lock, opal_mutex_t);
RB_INIT(&ompi_timetree); RB_INIT(&opal_timetree);
TAILQ_INIT(&ompi_eventqueue); TAILQ_INIT(&opal_eventqueue);
TAILQ_INIT(&ompi_activequeue); TAILQ_INIT(&opal_activequeue);
TAILQ_INIT(&ompi_signalqueue); TAILQ_INIT(&opal_signalqueue);
ompi_evbase = NULL; opal_evbase = NULL;
for (i = 0; ompi_eventops[i] && !ompi_evbase; i++) { for (i = 0; opal_eventops[i] && !opal_evbase; i++) {
ompi_evsel = ompi_eventops[i]; opal_evsel = opal_eventops[i];
ompi_evbase = ompi_evsel->init(); opal_evbase = opal_evsel->init();
} }
if (ompi_evbase == NULL) if (opal_evbase == NULL)
errx(1, "%s: no event mechanism available", __func__); errx(1, "%s: no event mechanism available", __func__);
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
#endif #endif
ompi_event_enable(); opal_event_enable();
#if defined(USE_LOG) && defined(USE_DEBUG) #if defined(USE_LOG) && defined(USE_DEBUG)
log_to(stderr); log_to(stderr);
@ -278,129 +278,129 @@ ompi_event_init(void)
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
int ompi_event_fini(void) int opal_event_fini(void)
{ {
ompi_event_disable(); opal_event_disable();
ompi_event_inited--; opal_event_inited--;
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
int ompi_event_disable(void) int opal_event_disable(void)
{ {
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
if(ompi_event_inited > 0 && ompi_event_enabled == false) { if(opal_event_inited > 0 && opal_event_enabled == false) {
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
ompi_event_enabled = false; opal_event_enabled = false;
if(ompi_event_pipe_signalled == 0) { if(opal_event_pipe_signalled == 0) {
unsigned char byte = 0; unsigned char byte = 0;
if(write(ompi_event_pipe[1], &byte, 1) != 1) if(write(opal_event_pipe[1], &byte, 1) != 1)
ompi_output(0, "ompi_event_add: write() to ompi_event_pipe[1] failed with errno=%d\n", errno); ompi_output(0, "opal_event_add: write() to opal_event_pipe[1] failed with errno=%d\n", errno);
ompi_event_pipe_signalled++; opal_event_pipe_signalled++;
} }
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
opal_thread_join(&ompi_event_thread, NULL); opal_thread_join(&opal_event_thread, NULL);
} else { } else {
ompi_event_enabled = false; opal_event_enabled = false;
} }
#else #else
ompi_event_enabled = false; opal_event_enabled = false;
#endif #endif
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
int ompi_event_enable(void) int opal_event_enable(void)
{ {
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
if(opal_using_threads()) { if(opal_using_threads()) {
int rc; int rc;
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
if(ompi_event_inited > 0 && ompi_event_enabled == true) { if(opal_event_inited > 0 && opal_event_enabled == true) {
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
/* create a pipe to signal the event thread */ /* create a pipe to signal the event thread */
if(pipe(ompi_event_pipe) != 0) { if(pipe(opal_event_pipe) != 0) {
ompi_output(0, "ompi_event_init: pipe() failed with errno=%d\n", errno); ompi_output(0, "opal_event_init: pipe() failed with errno=%d\n", errno);
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return OMPI_ERROR; return OMPI_ERROR;
} }
ompi_event_pipe_signalled = 1; opal_event_pipe_signalled = 1;
ompi_event_set( opal_event_set(
&ompi_event_pipe_event, &opal_event_pipe_event,
ompi_event_pipe[0], opal_event_pipe[0],
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
ompi_event_pipe_handler, opal_event_pipe_handler,
0); 0);
ompi_event_add_i(&ompi_event_pipe_event, 0); opal_event_add_i(&opal_event_pipe_event, 0);
ompi_event_pipe_signalled = 0; opal_event_pipe_signalled = 0;
/* spin up a thread to dispatch events */ /* spin up a thread to dispatch events */
OBJ_CONSTRUCT(&ompi_event_thread, opal_thread_t); OBJ_CONSTRUCT(&opal_event_thread, opal_thread_t);
ompi_event_enabled = true; opal_event_enabled = true;
ompi_event_thread.t_run = ompi_event_run; opal_event_thread.t_run = opal_event_run;
if((rc = opal_thread_start(&ompi_event_thread)) != OMPI_SUCCESS) { if((rc = opal_thread_start(&opal_event_thread)) != OMPI_SUCCESS) {
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return rc; return rc;
} }
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
} else { } else {
ompi_event_pipe[0] = -1; opal_event_pipe[0] = -1;
ompi_event_pipe[1] = -1; opal_event_pipe[1] = -1;
ompi_event_enabled = true; opal_event_enabled = true;
} }
#else #else
ompi_event_enabled = true; opal_event_enabled = true;
#endif #endif
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
int ompi_event_restart(void) int opal_event_restart(void)
{ {
int rc; int rc;
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
if(ompi_event_pipe[0] >= 0) { if(opal_event_pipe[0] >= 0) {
ompi_event_del_i(&ompi_event_pipe_event); opal_event_del_i(&opal_event_pipe_event);
/* do not close pipes - in case of bproc_vrfork they are not open /* do not close pipes - in case of bproc_vrfork they are not open
* and we may close something else * and we may close something else
*/ */
ompi_event_pipe[0] = -1; opal_event_pipe[0] = -1;
ompi_event_pipe[1] = -1; opal_event_pipe[1] = -1;
} }
ompi_event_enabled = false; opal_event_enabled = false;
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
#endif #endif
ompi_event_enable(); opal_event_enable();
if((rc = ompi_evsignal_restart()) != 0) if((rc = opal_evsignal_restart()) != 0)
return OMPI_ERROR; return OMPI_ERROR;
return (OMPI_SUCCESS); return (OMPI_SUCCESS);
} }
int ompi_event_haveevents(void) int opal_event_haveevents(void)
{ {
return (RB_ROOT(&ompi_timetree) || TAILQ_FIRST(&ompi_eventqueue) || return (RB_ROOT(&opal_timetree) || TAILQ_FIRST(&opal_eventqueue) ||
TAILQ_FIRST(&ompi_signalqueue) || TAILQ_FIRST(&ompi_activequeue)); TAILQ_FIRST(&opal_signalqueue) || TAILQ_FIRST(&opal_activequeue));
} }
static void static void
ompi_event_process_active(void) opal_event_process_active(void)
{ {
struct ompi_event *ev; struct opal_event *ev;
short ncalls; short ncalls;
for (ev = TAILQ_FIRST(&ompi_activequeue); ev; for (ev = TAILQ_FIRST(&opal_activequeue); ev;
ev = TAILQ_FIRST(&ompi_activequeue)) { ev = TAILQ_FIRST(&opal_activequeue)) {
ompi_event_queue_remove(ev, OMPI_EVLIST_ACTIVE); opal_event_queue_remove(ev, OPAL_EVLIST_ACTIVE);
/* Allows deletes to work */ /* Allows deletes to work */
ncalls = ev->ev_ncalls; ncalls = ev->ev_ncalls;
@ -409,9 +409,9 @@ ompi_event_process_active(void)
ncalls--; ncalls--;
ev->ev_ncalls = ncalls; ev->ev_ncalls = ncalls;
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
(*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg); (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg);
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
} else { } else {
(*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg); (*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg);
} }
@ -420,126 +420,126 @@ ompi_event_process_active(void)
} }
int int
ompi_event_dispatch(void) opal_event_dispatch(void)
{ {
return (ompi_event_loop(0)); return (opal_event_loop(0));
} }
int int
ompi_event_loop(int flags) opal_event_loop(int flags)
{ {
struct timeval tv; struct timeval tv;
int res, done; int res, done;
int num_active = 0; int num_active = 0;
if (ompi_event_inited == false) if (opal_event_inited == false)
return(0); return(0);
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
} }
/* Calculate the initial events that we are waiting for */ /* Calculate the initial events that we are waiting for */
if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) { if (opal_evsel->recalc && opal_evsel->recalc(opal_evbase, 0) == -1) {
ompi_output(0, "ompi_event_loop: ompi_evsel->recalc() failed."); ompi_output(0, "opal_event_loop: opal_evsel->recalc() failed.");
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return (-1); return (-1);
} }
done = 0; done = 0;
while (!done && ompi_event_enabled) { while (!done && opal_event_enabled) {
while (ompi_event_gotsig) { while (opal_event_gotsig) {
ompi_event_gotsig = 0; opal_event_gotsig = 0;
if (ompi_event_sigcb) { if (opal_event_sigcb) {
res = (*ompi_event_sigcb)(); res = (*opal_event_sigcb)();
if (res == -1) { if (res == -1) {
ompi_output(0, "ompi_event_loop: ompi_event_sigcb() failed."); ompi_output(0, "opal_event_loop: opal_event_sigcb() failed.");
errno = EINTR; errno = EINTR;
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return (-1); return (-1);
} }
} }
} }
if (!(flags & OMPI_EVLOOP_NONBLOCK)) { if (!(flags & OPAL_EVLOOP_NONBLOCK)) {
static struct timeval dflt = OMPI_TIMEOUT_DEFAULT; static struct timeval dflt = OPAL_TIMEOUT_DEFAULT;
tv = dflt; tv = dflt;
} else } else
timerclear(&tv); timerclear(&tv);
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
ompi_event_pipe_signalled = 0; opal_event_pipe_signalled = 0;
#endif #endif
res = ompi_evsel->dispatch(ompi_evbase, &tv); res = opal_evsel->dispatch(opal_evbase, &tv);
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
ompi_event_pipe_signalled = 1; opal_event_pipe_signalled = 1;
#endif #endif
if (res == -1) { if (res == -1) {
ompi_output(0, "ompi_event_loop: ompi_evesel->dispatch() failed."); ompi_output(0, "opal_event_loop: ompi_evesel->dispatch() failed.");
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return (-1); return (-1);
} }
if(NULL != RB_MIN(ompi_event_tree, &ompi_timetree)) { if(NULL != RB_MIN(opal_event_tree, &opal_timetree)) {
/* Check if time is running backwards */ /* Check if time is running backwards */
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
if (timercmp(&tv, &ompi_event_tv, <)) { if (timercmp(&tv, &opal_event_tv, <)) {
struct timeval off; struct timeval off;
LOG_DBG((LOG_MISC, 10, LOG_DBG((LOG_MISC, 10,
"%s: time is running backwards, corrected", "%s: time is running backwards, corrected",
__func__)); __func__));
timersub(&ompi_event_tv, &tv, &off); timersub(&opal_event_tv, &tv, &off);
ompi_timeout_correct(&off); opal_timeout_correct(&off);
} }
ompi_event_tv = tv; opal_event_tv = tv;
ompi_timeout_process(); opal_timeout_process();
} }
if (TAILQ_FIRST(&ompi_activequeue)) { if (TAILQ_FIRST(&opal_activequeue)) {
num_active++; num_active++;
ompi_event_process_active(); opal_event_process_active();
if (flags & OMPI_EVLOOP_ONCE) if (flags & OPAL_EVLOOP_ONCE)
done = 1; done = 1;
} else if (flags & (OMPI_EVLOOP_NONBLOCK|OMPI_EVLOOP_ONCE)) } else if (flags & (OPAL_EVLOOP_NONBLOCK|OPAL_EVLOOP_ONCE))
done = 1; done = 1;
if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) { if (opal_evsel->recalc && opal_evsel->recalc(opal_evbase, 0) == -1) {
ompi_output(0, "ompi_event_loop: ompi_evesel->recalc() failed."); ompi_output(0, "opal_event_loop: ompi_evesel->recalc() failed.");
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return (-1); return (-1);
} }
} }
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
return (num_active); return (num_active);
} }
int int
ompi_event_add_i(struct ompi_event *ev, struct timeval *tv) opal_event_add_i(struct opal_event *ev, struct timeval *tv)
{ {
int rc = 0; int rc = 0;
LOG_DBG((LOG_MISC, 55, LOG_DBG((LOG_MISC, 55,
"event_add: event: %p, %s%s%scall %p", "event_add: event: %p, %s%s%scall %p",
ev, ev,
ev->ev_events & OMPI_EV_READ ? "OMPI_EV_READ " : " ", ev->ev_events & OPAL_EV_READ ? "OPAL_EV_READ " : " ",
ev->ev_events & OMPI_EV_WRITE ? "OMPI_EV_WRITE " : " ", ev->ev_events & OPAL_EV_WRITE ? "OPAL_EV_WRITE " : " ",
tv ? "OMPI_EV_TIMEOUT " : " ", tv ? "OPAL_EV_TIMEOUT " : " ",
ev->ev_callback)); ev->ev_callback));
assert(!(ev->ev_flags & ~OMPI_EVLIST_ALL)); assert(!(ev->ev_flags & ~OPAL_EVLIST_ALL));
if (tv != NULL) { if (tv != NULL) {
struct timeval now; struct timeval now;
if (ev->ev_flags & OMPI_EVLIST_TIMEOUT) if (ev->ev_flags & OPAL_EVLIST_TIMEOUT)
ompi_event_queue_remove(ev, OMPI_EVLIST_TIMEOUT); opal_event_queue_remove(ev, OPAL_EVLIST_TIMEOUT);
/* Check if it is active due to a timeout. Rescheduling /* Check if it is active due to a timeout. Rescheduling
* this timeout before the callback can be executed * this timeout before the callback can be executed
* removes it from the active list. */ * removes it from the active list. */
if ((ev->ev_flags & OMPI_EVLIST_ACTIVE) && if ((ev->ev_flags & OPAL_EVLIST_ACTIVE) &&
(ev->ev_res & OMPI_EV_TIMEOUT)) { (ev->ev_res & OPAL_EV_TIMEOUT)) {
/* See if we are just active executing this /* See if we are just active executing this
* event in a loop * event in a loop
*/ */
@ -548,7 +548,7 @@ ompi_event_add_i(struct ompi_event *ev, struct timeval *tv)
*ev->ev_pncalls = 0; *ev->ev_pncalls = 0;
} }
ompi_event_queue_remove(ev, OMPI_EVLIST_ACTIVE); opal_event_queue_remove(ev, OPAL_EVLIST_ACTIVE);
} }
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
@ -558,35 +558,35 @@ ompi_event_add_i(struct ompi_event *ev, struct timeval *tv)
"event_add: timeout in %d seconds, call %p", "event_add: timeout in %d seconds, call %p",
tv->tv_sec, ev->ev_callback)); tv->tv_sec, ev->ev_callback));
ompi_event_queue_insert(ev, OMPI_EVLIST_TIMEOUT); opal_event_queue_insert(ev, OPAL_EVLIST_TIMEOUT);
} }
if ((ev->ev_events & (OMPI_EV_READ|OMPI_EV_WRITE)) && if ((ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE)) &&
!(ev->ev_flags & (OMPI_EVLIST_INSERTED|OMPI_EVLIST_ACTIVE))) { !(ev->ev_flags & (OPAL_EVLIST_INSERTED|OPAL_EVLIST_ACTIVE))) {
ompi_event_queue_insert(ev, OMPI_EVLIST_INSERTED); opal_event_queue_insert(ev, OPAL_EVLIST_INSERTED);
rc = (ompi_evsel->add(ompi_evbase, ev)); rc = (opal_evsel->add(opal_evbase, ev));
} else if ((ev->ev_events & OMPI_EV_SIGNAL) && } else if ((ev->ev_events & OPAL_EV_SIGNAL) &&
!(ev->ev_flags & OMPI_EVLIST_SIGNAL)) { !(ev->ev_flags & OPAL_EVLIST_SIGNAL)) {
ompi_event_queue_insert(ev, OMPI_EVLIST_SIGNAL); opal_event_queue_insert(ev, OPAL_EVLIST_SIGNAL);
rc = (ompi_evsel->add(ompi_evbase, ev)); rc = (opal_evsel->add(opal_evbase, ev));
} }
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
if(opal_using_threads() && ompi_event_pipe_signalled == 0) { if(opal_using_threads() && opal_event_pipe_signalled == 0) {
unsigned char byte = 0; unsigned char byte = 0;
if(write(ompi_event_pipe[1], &byte, 1) != 1) if(write(opal_event_pipe[1], &byte, 1) != 1)
ompi_output(0, "ompi_event_add: write() to ompi_event_pipe[1] failed with errno=%d\n", errno); ompi_output(0, "opal_event_add: write() to opal_event_pipe[1] failed with errno=%d\n", errno);
ompi_event_pipe_signalled++; opal_event_pipe_signalled++;
} }
#endif #endif
return rc; return rc;
} }
int ompi_event_del_i(struct ompi_event *ev) int opal_event_del_i(struct opal_event *ev)
{ {
int rc = 0; int rc = 0;
assert(!(ev->ev_flags & ~OMPI_EVLIST_ALL)); assert(!(ev->ev_flags & ~OPAL_EVLIST_ALL));
/* See if we are just active executing this event in a loop */ /* See if we are just active executing this event in a loop */
if (ev->ev_ncalls && ev->ev_pncalls) { if (ev->ev_ncalls && ev->ev_pncalls) {
@ -594,26 +594,26 @@ int ompi_event_del_i(struct ompi_event *ev)
*ev->ev_pncalls = 0; *ev->ev_pncalls = 0;
} }
if (ev->ev_flags & OMPI_EVLIST_TIMEOUT) if (ev->ev_flags & OPAL_EVLIST_TIMEOUT)
ompi_event_queue_remove(ev, OMPI_EVLIST_TIMEOUT); opal_event_queue_remove(ev, OPAL_EVLIST_TIMEOUT);
if (ev->ev_flags & OMPI_EVLIST_ACTIVE) if (ev->ev_flags & OPAL_EVLIST_ACTIVE)
ompi_event_queue_remove(ev, OMPI_EVLIST_ACTIVE); opal_event_queue_remove(ev, OPAL_EVLIST_ACTIVE);
if (ev->ev_flags & OMPI_EVLIST_INSERTED) { if (ev->ev_flags & OPAL_EVLIST_INSERTED) {
ompi_event_queue_remove(ev, OMPI_EVLIST_INSERTED); opal_event_queue_remove(ev, OPAL_EVLIST_INSERTED);
rc = (ompi_evsel->del(ompi_evbase, ev)); rc = (opal_evsel->del(opal_evbase, ev));
} else if (ev->ev_flags & OMPI_EVLIST_SIGNAL) { } else if (ev->ev_flags & OPAL_EVLIST_SIGNAL) {
ompi_event_queue_remove(ev, OMPI_EVLIST_SIGNAL); opal_event_queue_remove(ev, OPAL_EVLIST_SIGNAL);
rc = (ompi_evsel->del(ompi_evbase, ev)); rc = (opal_evsel->del(opal_evbase, ev));
} }
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
if(opal_using_threads() && ompi_event_pipe_signalled == 0) { if(opal_using_threads() && opal_event_pipe_signalled == 0) {
unsigned char byte = 0; unsigned char byte = 0;
if(write(ompi_event_pipe[1], &byte, 1) != 1) if(write(opal_event_pipe[1], &byte, 1) != 1)
ompi_output(0, "ompi_event_add: write() to ompi_event_pipe[1] failed with errno=%d\n", errno); ompi_output(0, "opal_event_add: write() to opal_event_pipe[1] failed with errno=%d\n", errno);
ompi_event_pipe_signalled++; opal_event_pipe_signalled++;
} }
#endif #endif
return (rc); return (rc);
@ -621,48 +621,48 @@ int ompi_event_del_i(struct ompi_event *ev)
static void static void
ompi_timeout_correct(struct timeval *off) opal_timeout_correct(struct timeval *off)
{ {
struct ompi_event *ev; struct opal_event *ev;
/* We can modify the key element of the node without destroying /* We can modify the key element of the node without destroying
* the key, beause we apply it to all in the right order. * the key, beause we apply it to all in the right order.
*/ */
RB_FOREACH(ev, ompi_event_tree, &ompi_timetree) RB_FOREACH(ev, opal_event_tree, &opal_timetree)
timersub(&ev->ev_timeout, off, &ev->ev_timeout); timersub(&ev->ev_timeout, off, &ev->ev_timeout);
} }
static void static void
ompi_timeout_process(void) opal_timeout_process(void)
{ {
struct timeval now; struct timeval now;
struct ompi_event *ev, *next; struct opal_event *ev, *next;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
for (ev = RB_MIN(ompi_event_tree, &ompi_timetree); ev; ev = next) { for (ev = RB_MIN(opal_event_tree, &opal_timetree); ev; ev = next) {
if (timercmp(&ev->ev_timeout, &now, >)) if (timercmp(&ev->ev_timeout, &now, >))
break; break;
next = RB_NEXT(ompi_event_tree, &ompi_timetree, ev); next = RB_NEXT(opal_event_tree, &opal_timetree, ev);
ompi_event_queue_remove(ev, OMPI_EVLIST_TIMEOUT); opal_event_queue_remove(ev, OPAL_EVLIST_TIMEOUT);
/* delete this event from the I/O queues */ /* delete this event from the I/O queues */
ompi_event_del_i(ev); opal_event_del_i(ev);
LOG_DBG((LOG_MISC, 60, "timeout_process: call %p", LOG_DBG((LOG_MISC, 60, "timeout_process: call %p",
ev->ev_callback)); ev->ev_callback));
ompi_event_active_i(ev, OMPI_EV_TIMEOUT, 1); opal_event_active_i(ev, OPAL_EV_TIMEOUT, 1);
} }
} }
static void static void
ompi_timeout_insert(struct ompi_event *ev) opal_timeout_insert(struct opal_event *ev)
{ {
struct ompi_event *tmp; struct opal_event *tmp;
tmp = RB_FIND(ompi_event_tree, &ompi_timetree, ev); tmp = RB_FIND(opal_event_tree, &opal_timetree, ev);
if (tmp != NULL) { if (tmp != NULL) {
struct timeval tv; struct timeval tv;
@ -672,18 +672,18 @@ ompi_timeout_insert(struct ompi_event *ev)
tv = ev->ev_timeout; tv = ev->ev_timeout;
do { do {
timeradd(&tv, &add, &tv); timeradd(&tv, &add, &tv);
tmp = RB_NEXT(ompi_event_tree, &ompi_timetree, tmp); tmp = RB_NEXT(opal_event_tree, &opal_timetree, tmp);
} while (tmp != NULL && timercmp(&tmp->ev_timeout, &tv, ==)); } while (tmp != NULL && timercmp(&tmp->ev_timeout, &tv, ==));
ev->ev_timeout = tv; ev->ev_timeout = tv;
} }
tmp = RB_INSERT(ompi_event_tree, &ompi_timetree, ev); tmp = RB_INSERT(opal_event_tree, &opal_timetree, ev);
assert(tmp == NULL); assert(tmp == NULL);
} }
static void static void
ompi_event_queue_remove(struct ompi_event *ev, int queue) opal_event_queue_remove(struct opal_event *ev, int queue)
{ {
if (!(ev->ev_flags & queue)) if (!(ev->ev_flags & queue))
errx(1, "%s: %p(fd %d) not on queue %x", __func__, errx(1, "%s: %p(fd %d) not on queue %x", __func__,
@ -691,17 +691,17 @@ ompi_event_queue_remove(struct ompi_event *ev, int queue)
ev->ev_flags &= ~queue; ev->ev_flags &= ~queue;
switch (queue) { switch (queue) {
case OMPI_EVLIST_ACTIVE: case OPAL_EVLIST_ACTIVE:
TAILQ_REMOVE(&ompi_activequeue, ev, ev_active_next); TAILQ_REMOVE(&opal_activequeue, ev, ev_active_next);
break; break;
case OMPI_EVLIST_SIGNAL: case OPAL_EVLIST_SIGNAL:
TAILQ_REMOVE(&ompi_signalqueue, ev, ev_signal_next); TAILQ_REMOVE(&opal_signalqueue, ev, ev_signal_next);
break; break;
case OMPI_EVLIST_TIMEOUT: case OPAL_EVLIST_TIMEOUT:
RB_REMOVE(ompi_event_tree, &ompi_timetree, ev); RB_REMOVE(opal_event_tree, &opal_timetree, ev);
break; break;
case OMPI_EVLIST_INSERTED: case OPAL_EVLIST_INSERTED:
TAILQ_REMOVE(&ompi_eventqueue, ev, ev_next); TAILQ_REMOVE(&opal_eventqueue, ev, ev_next);
break; break;
default: default:
errx(1, "%s: unknown queue %x", __func__, queue); errx(1, "%s: unknown queue %x", __func__, queue);
@ -709,7 +709,7 @@ ompi_event_queue_remove(struct ompi_event *ev, int queue)
} }
static void static void
ompi_event_queue_insert(struct ompi_event *ev, int queue) opal_event_queue_insert(struct opal_event *ev, int queue)
{ {
if (ev->ev_flags & queue) if (ev->ev_flags & queue)
errx(1, "%s: %p(fd %d) already on queue %x", __func__, errx(1, "%s: %p(fd %d) already on queue %x", __func__,
@ -717,27 +717,27 @@ ompi_event_queue_insert(struct ompi_event *ev, int queue)
ev->ev_flags |= queue; ev->ev_flags |= queue;
switch (queue) { switch (queue) {
case OMPI_EVLIST_ACTIVE: case OPAL_EVLIST_ACTIVE:
TAILQ_INSERT_TAIL(&ompi_activequeue, ev, ev_active_next); TAILQ_INSERT_TAIL(&opal_activequeue, ev, ev_active_next);
break; break;
case OMPI_EVLIST_SIGNAL: case OPAL_EVLIST_SIGNAL:
TAILQ_INSERT_TAIL(&ompi_signalqueue, ev, ev_signal_next); TAILQ_INSERT_TAIL(&opal_signalqueue, ev, ev_signal_next);
break; break;
case OMPI_EVLIST_TIMEOUT: case OPAL_EVLIST_TIMEOUT:
ompi_timeout_insert(ev); opal_timeout_insert(ev);
break; break;
case OMPI_EVLIST_INSERTED: case OPAL_EVLIST_INSERTED:
TAILQ_INSERT_TAIL(&ompi_eventqueue, ev, ev_next); TAILQ_INSERT_TAIL(&opal_eventqueue, ev, ev_next);
break; break;
default: default:
errx(1, "%s: unknown queue %x", __func__, queue); errx(1, "%s: unknown queue %x", __func__, queue);
} }
} }
void ompi_event_active_i(struct ompi_event * ev, int res, short ncalls) void opal_event_active_i(struct opal_event * ev, int res, short ncalls)
{ {
/* We get different kinds of events, add them together */ /* We get different kinds of events, add them together */
if (ev->ev_flags & OMPI_EVLIST_ACTIVE) { if (ev->ev_flags & OPAL_EVLIST_ACTIVE) {
ev->ev_res |= res; ev->ev_res |= res;
return; return;
} }
@ -745,7 +745,7 @@ void ompi_event_active_i(struct ompi_event * ev, int res, short ncalls)
ev->ev_res = res; ev->ev_res = res;
ev->ev_ncalls = ncalls; ev->ev_ncalls = ncalls;
ev->ev_pncalls = NULL; ev->ev_pncalls = NULL;
ompi_event_queue_insert(ev, OMPI_EVLIST_ACTIVE); opal_event_queue_insert(ev, OPAL_EVLIST_ACTIVE);
} }

Просмотреть файл

@ -49,23 +49,23 @@ extern "C" {
#include <windows.h> #include <windows.h>
#endif #endif
#define OMPI_EVLIST_TIMEOUT 0x01 #define OPAL_EVLIST_TIMEOUT 0x01
#define OMPI_EVLIST_INSERTED 0x02 #define OPAL_EVLIST_INSERTED 0x02
#define OMPI_EVLIST_SIGNAL 0x04 #define OPAL_EVLIST_SIGNAL 0x04
#define OMPI_EVLIST_ACTIVE 0x08 #define OPAL_EVLIST_ACTIVE 0x08
#define OMPI_EVLIST_INIT 0x80 #define OPAL_EVLIST_INIT 0x80
/* EVLIST_X_ Private space: 0x1000-0xf000 */ /* EVLIST_X_ Private space: 0x1000-0xf000 */
#define OMPI_EVLIST_ALL (0xf000 | 0x8f) #define OPAL_EVLIST_ALL (0xf000 | 0x8f)
#define OMPI_EV_TIMEOUT 0x01 #define OPAL_EV_TIMEOUT 0x01
#define OMPI_EV_READ 0x02 #define OPAL_EV_READ 0x02
#define OMPI_EV_WRITE 0x04 #define OPAL_EV_WRITE 0x04
#define OMPI_EV_SIGNAL 0x08 #define OPAL_EV_SIGNAL 0x08
#define OMPI_EV_PERSIST 0x10 /* Persistant event */ #define OPAL_EV_PERSIST 0x10 /* Persistant event */
#ifdef OMPI_EVENT_USE_SIGNALS #ifdef OPAL_EVENT_USE_SIGNALS
#undef OMPI_EVENT_USE_SIGNALS #undef OPAL_EVENT_USE_SIGNALS
#endif #endif
#ifdef WIN32 #ifdef WIN32
/* We do not have the required framework for EVENT_SIGNALS to work on windows. /* We do not have the required framework for EVENT_SIGNALS to work on windows.
@ -77,9 +77,9 @@ extern "C" {
2. Since the EVENT_SIGNALS are disabled, instances of code which rely on 2. Since the EVENT_SIGNALS are disabled, instances of code which rely on
this mechanism will NOT work under windows this mechanism will NOT work under windows
*/ */
#define OMPI_EVENT_USE_SIGNALS 0 #define OPAL_EVENT_USE_SIGNALS 0
#else #else
#define OMPI_EVENT_USE_SIGNALS 1 #define OPAL_EVENT_USE_SIGNALS 1
#endif #endif
/* Fix so that ppl dont have to run with <sys/queue.h> */ /* Fix so that ppl dont have to run with <sys/queue.h> */
@ -102,11 +102,11 @@ struct { \
} }
#endif /* !RB_ENTRY */ #endif /* !RB_ENTRY */
struct ompi_event { struct opal_event {
TAILQ_ENTRY (ompi_event) ev_next; TAILQ_ENTRY (opal_event) ev_next;
TAILQ_ENTRY (ompi_event) ev_active_next; TAILQ_ENTRY (opal_event) ev_active_next;
TAILQ_ENTRY (ompi_event) ev_signal_next; TAILQ_ENTRY (opal_event) ev_signal_next;
RB_ENTRY (ompi_event) ev_timeout_node; RB_ENTRY (opal_event) ev_timeout_node;
#ifdef WIN32 #ifdef WIN32
HANDLE ev_fd; HANDLE ev_fd;
@ -126,74 +126,74 @@ struct ompi_event {
int ev_res; /* result passed to event callback */ int ev_res; /* result passed to event callback */
int ev_flags; int ev_flags;
}; };
typedef struct ompi_event ompi_event_t; typedef struct opal_event opal_event_t;
#define OMPI_EVENT_SIGNAL(ev) (int)ev->ev_fd #define OPAL_EVENT_SIGNAL(ev) (int)ev->ev_fd
#define OMPI_EVENT_FD(ev) (int)ev->ev_fd #define OPAL_EVENT_FD(ev) (int)ev->ev_fd
#ifdef _EVENT_DEFINED_TQENTRY #ifdef _EVENT_DEFINED_TQENTRY
#undef TAILQ_ENTRY #undef TAILQ_ENTRY
#undef _EVENT_DEFINED_TQENTRY #undef _EVENT_DEFINED_TQENTRY
#else #else
TAILQ_HEAD (ompi_event_list, ompi_event); TAILQ_HEAD (opal_event_list, opal_event);
#endif /* _EVENT_DEFINED_TQENTRY */ #endif /* _EVENT_DEFINED_TQENTRY */
#ifdef _EVENT_DEFINED_RBENTRY #ifdef _EVENT_DEFINED_RBENTRY
#undef RB_ENTRY #undef RB_ENTRY
#undef _EVENT_DEFINED_RBENTRY #undef _EVENT_DEFINED_RBENTRY
#endif /* _EVENT_DEFINED_RBENTRY */ #endif /* _EVENT_DEFINED_RBENTRY */
struct ompi_eventop { struct opal_eventop {
char *name; char *name;
void *(*init)(void); void *(*init)(void);
int (*add)(void *, struct ompi_event *); int (*add)(void *, struct opal_event *);
int (*del)(void *, struct ompi_event *); int (*del)(void *, struct opal_event *);
int (*recalc)(void *, int); int (*recalc)(void *, int);
int (*dispatch)(void *, struct timeval *); int (*dispatch)(void *, struct timeval *);
}; };
#define OMPI_TIMEOUT_DEFAULT {1, 0} #define OPAL_TIMEOUT_DEFAULT {1, 0}
#define OMPI_EVLOOP_ONCE 0x01 #define OPAL_EVLOOP_ONCE 0x01
#define OMPI_EVLOOP_NONBLOCK 0x02 #define OPAL_EVLOOP_NONBLOCK 0x02
OMPI_DECLSPEC int ompi_event_init(void); OMPI_DECLSPEC int opal_event_init(void);
OMPI_DECLSPEC int ompi_event_fini(void); OMPI_DECLSPEC int opal_event_fini(void);
OMPI_DECLSPEC int ompi_event_dispatch(void); OMPI_DECLSPEC int opal_event_dispatch(void);
OMPI_DECLSPEC int ompi_event_loop(int); OMPI_DECLSPEC int opal_event_loop(int);
OMPI_DECLSPEC int ompi_event_enable(void); OMPI_DECLSPEC int opal_event_enable(void);
OMPI_DECLSPEC int ompi_event_disable(void); OMPI_DECLSPEC int opal_event_disable(void);
OMPI_DECLSPEC bool ompi_event_progress_thread(void); OMPI_DECLSPEC bool opal_event_progress_thread(void);
OMPI_DECLSPEC int ompi_event_restart(void); OMPI_DECLSPEC int opal_event_restart(void);
#define ompi_evtimer_add(ev, tv) ompi_event_add(ev, tv) #define opal_evtimer_add(ev, tv) opal_event_add(ev, tv)
#define ompi_evtimer_set(ev, cb, arg) ompi_event_set(ev, -1, 0, cb, arg) #define opal_evtimer_set(ev, cb, arg) opal_event_set(ev, -1, 0, cb, arg)
#define ompi_evtimer_del(ev) ompi_event_del(ev) #define opal_evtimer_del(ev) opal_event_del(ev)
#define ompi_evtimer_pending(ev, tv) ompi_event_pending(ev, OMPI_EV_TIMEOUT, tv) #define opal_evtimer_pending(ev, tv) opal_event_pending(ev, OPAL_EV_TIMEOUT, tv)
#define ompi_evtimer_initialized(ev) (ev)->ev_flags & OMPI_EVLIST_INIT) #define opal_evtimer_initialized(ev) (ev)->ev_flags & OPAL_EVLIST_INIT)
#define ompi_timeout_add(ev, tv) ompi_event_add(ev, tv) #define opal_timeout_add(ev, tv) opal_event_add(ev, tv)
#define ompi_timeout_set(ev, cb, arg) ompi_event_set(ev, -1, 0, cb, arg) #define opal_timeout_set(ev, cb, arg) opal_event_set(ev, -1, 0, cb, arg)
#define ompi_timeout_del(ev) ompi_event_del(ev) #define opal_timeout_del(ev) opal_event_del(ev)
#define ompi_timeout_pending(ev, tv) ompi_event_pending(ev, OMPI_EV_TIMEOUT, tv) #define opal_timeout_pending(ev, tv) opal_event_pending(ev, OPAL_EV_TIMEOUT, tv)
#define ompi_timeout_initialized(ev) ((ev)->ev_flags & OMPI_EVLIST_INIT) #define opal_timeout_initialized(ev) ((ev)->ev_flags & OPAL_EVLIST_INIT)
#define ompi_signal_add(ev, tv) ompi_event_add(ev, tv) #define opal_signal_add(ev, tv) opal_event_add(ev, tv)
#define ompi_signal_set(ev, x, cb, arg) \ #define opal_signal_set(ev, x, cb, arg) \
ompi_event_set(ev, x, OMPI_EV_SIGNAL|OMPI_EV_PERSIST, cb, arg) opal_event_set(ev, x, OPAL_EV_SIGNAL|OPAL_EV_PERSIST, cb, arg)
#define ompi_signal_del(ev) ompi_event_del(ev) #define opal_signal_del(ev) opal_event_del(ev)
#define ompi_signal_pending(ev, tv) ompi_event_pending(ev, OMPI_EV_SIGNAL, tv) #define opal_signal_pending(ev, tv) opal_event_pending(ev, OPAL_EV_SIGNAL, tv)
#define ompi_signal_initialized(ev) ((ev)->ev_flags & OMPI_EVLIST_INIT) #define opal_signal_initialized(ev) ((ev)->ev_flags & OPAL_EVLIST_INIT)
/* for internal use only */ /* for internal use only */
OMPI_DECLSPEC int ompi_event_add_i(struct ompi_event *, struct timeval *); OMPI_DECLSPEC int opal_event_add_i(struct opal_event *, struct timeval *);
OMPI_DECLSPEC int ompi_event_del_i(struct ompi_event *); OMPI_DECLSPEC int opal_event_del_i(struct opal_event *);
OMPI_DECLSPEC void ompi_event_active_i(struct ompi_event*, int, short); OMPI_DECLSPEC void opal_event_active_i(struct opal_event*, int, short);
OMPI_DECLSPEC extern opal_mutex_t ompi_event_lock; OMPI_DECLSPEC extern opal_mutex_t opal_event_lock;
OMPI_DECLSPEC extern int ompi_evsignal_restart(void); OMPI_DECLSPEC extern int opal_evsignal_restart(void);
/* public functions */ /* public functions */
static inline void static inline void
ompi_event_set(struct ompi_event *ev, int fd, short events, opal_event_set(struct opal_event *ev, int fd, short events,
void (*callback)(int, short, void *), void *arg) void (*callback)(int, short, void *), void *arg)
{ {
ev->ev_callback = callback; ev->ev_callback = callback;
@ -205,69 +205,69 @@ ompi_event_set(struct ompi_event *ev, int fd, short events,
ev->ev_fd = fd; ev->ev_fd = fd;
#endif #endif
ev->ev_events = events; ev->ev_events = events;
ev->ev_flags = OMPI_EVLIST_INIT; ev->ev_flags = OPAL_EVLIST_INIT;
ev->ev_ncalls = 0; ev->ev_ncalls = 0;
ev->ev_pncalls = NULL; ev->ev_pncalls = NULL;
} }
static inline int static inline int
ompi_event_add(struct ompi_event *ev, struct timeval *tv) opal_event_add(struct opal_event *ev, struct timeval *tv)
{ {
extern opal_mutex_t ompi_event_lock; extern opal_mutex_t opal_event_lock;
int rc; int rc;
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
rc = ompi_event_add_i(ev, tv); rc = opal_event_add_i(ev, tv);
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
} else { } else {
rc = ompi_event_add_i(ev, tv); rc = opal_event_add_i(ev, tv);
} }
return rc; return rc;
} }
static inline int static inline int
ompi_event_del(struct ompi_event *ev) opal_event_del(struct opal_event *ev)
{ {
extern opal_mutex_t ompi_event_lock; extern opal_mutex_t opal_event_lock;
int rc; int rc;
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
rc = ompi_event_del_i(ev); rc = opal_event_del_i(ev);
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
} else { } else {
rc = ompi_event_del_i(ev); rc = opal_event_del_i(ev);
} }
return rc; return rc;
} }
static inline void static inline void
ompi_event_active(struct ompi_event* ev, int res, short ncalls) opal_event_active(struct opal_event* ev, int res, short ncalls)
{ {
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
ompi_event_active_i(ev, res, ncalls); opal_event_active_i(ev, res, ncalls);
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
} else { } else {
ompi_event_active_i(ev, res, ncalls); opal_event_active_i(ev, res, ncalls);
} }
} }
static inline int static inline int
ompi_event_pending(struct ompi_event *ev, short event, struct timeval *tv) opal_event_pending(struct opal_event *ev, short event, struct timeval *tv)
{ {
int flags = 0; int flags = 0;
if (ev->ev_flags & OMPI_EVLIST_INSERTED) if (ev->ev_flags & OPAL_EVLIST_INSERTED)
flags |= (ev->ev_events & (OMPI_EV_READ|OMPI_EV_WRITE)); flags |= (ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE));
if (ev->ev_flags & OMPI_EVLIST_ACTIVE) if (ev->ev_flags & OPAL_EVLIST_ACTIVE)
flags |= ev->ev_res; flags |= ev->ev_res;
if (ev->ev_flags & OMPI_EVLIST_TIMEOUT) if (ev->ev_flags & OPAL_EVLIST_TIMEOUT)
flags |= OMPI_EV_TIMEOUT; flags |= OPAL_EV_TIMEOUT;
event &= (OMPI_EV_TIMEOUT|OMPI_EV_READ|OMPI_EV_WRITE); event &= (OPAL_EV_TIMEOUT|OPAL_EV_READ|OPAL_EV_WRITE);
/* See if there is a timeout that we should report */ /* See if there is a timeout that we should report */
if (tv != NULL && (flags & event & OMPI_EV_TIMEOUT)) if (tv != NULL && (flags & event & OPAL_EV_TIMEOUT))
*tv = ev->ev_timeout; *tv = ev->ev_timeout;
return (flags & event); return (flags & event);
@ -275,9 +275,9 @@ ompi_event_pending(struct ompi_event *ev, short event, struct timeval *tv)
#ifdef WIN32 #ifdef WIN32
#define ompi_event_initialized(ev) ((ev)->ev_flags & OMPI_EVLIST_INIT && (ev)->ev_fd != INVALID_HANDLE_VALUE) #define opal_event_initialized(ev) ((ev)->ev_flags & OPAL_EVLIST_INIT && (ev)->ev_fd != INVALID_HANDLE_VALUE)
#else #else
#define ompi_event_initialized(ev) ((ev)->ev_flags & OMPI_EVLIST_INIT) #define opal_event_initialized(ev) ((ev)->ev_flags & OPAL_EVLIST_INIT)
#endif #endif
#if defined(c_plusplus) || defined(__cplusplus) #if defined(c_plusplus) || defined(__cplusplus)

Просмотреть файл

@ -27,11 +27,11 @@
#ifndef _EVSIGNAL_H_ #ifndef _EVSIGNAL_H_
#define _EVSIGNAL_H_ #define _EVSIGNAL_H_
void ompi_evsignal_init(sigset_t *); void opal_evsignal_init(sigset_t *);
void ompi_evsignal_process(void); void opal_evsignal_process(void);
int ompi_evsignal_recalc(sigset_t *); int opal_evsignal_recalc(sigset_t *);
int ompi_evsignal_deliver(sigset_t *); int opal_evsignal_deliver(sigset_t *);
int ompi_evsignal_add(sigset_t *, struct ompi_event *); int opal_evsignal_add(sigset_t *, struct opal_event *);
int ompi_evsignal_del(sigset_t *, struct ompi_event *); int opal_evsignal_del(sigset_t *, struct opal_event *);
#endif /* _EVSIGNAL_H_ */ #endif /* _EVSIGNAL_H_ */

Просмотреть файл

@ -70,7 +70,7 @@
extern struct event_list timequeue; extern struct event_list timequeue;
extern struct event_list eventqueue; extern struct event_list eventqueue;
extern struct event_list addqueue; extern struct event_list addqueue;
extern opal_mutex_t ompi_event_lock; extern opal_mutex_t opal_event_lock;
#define EVLIST_X_KQINKERNEL 0x1000 #define EVLIST_X_KQINKERNEL 0x1000
@ -85,13 +85,13 @@ struct kqop {
} kqueueop; } kqueueop;
static void *kq_init (void); static void *kq_init (void);
static int kq_add (void *, struct ompi_event *); static int kq_add (void *, struct opal_event *);
static int kq_del (void *, struct ompi_event *); static int kq_del (void *, struct opal_event *);
static int kq_recalc (void *, int); static int kq_recalc (void *, int);
static int kq_dispatch (void *, struct timeval *); static int kq_dispatch (void *, struct timeval *);
static int kq_insert (struct kqop *, struct kevent *); static int kq_insert (struct kqop *, struct kevent *);
const struct ompi_eventop ompi_kqops = { const struct opal_eventop opal_kqops = {
"kqueue", "kqueue",
kq_init, kq_init,
kq_add, kq_add,
@ -197,7 +197,7 @@ kq_dispatch(void *arg, struct timeval *tv)
struct kqop *kqop = arg; struct kqop *kqop = arg;
struct kevent *changes = kqop->changes; struct kevent *changes = kqop->changes;
struct kevent *events = kqop->events; struct kevent *events = kqop->events;
struct ompi_event *ev; struct opal_event *ev;
struct timespec ts; struct timespec ts;
int i, res; int i, res;
@ -205,10 +205,10 @@ kq_dispatch(void *arg, struct timeval *tv)
/* release lock while waiting in kernel */ /* release lock while waiting in kernel */
if(opal_using_threads()) { if(opal_using_threads()) {
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
res = kevent(kqop->kq, changes, kqop->nchanges, res = kevent(kqop->kq, changes, kqop->nchanges,
events, kqop->nevents, &ts); events, kqop->nevents, &ts);
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
} else { } else {
res = kevent(kqop->kq, changes, kqop->nchanges, res = kevent(kqop->kq, changes, kqop->nchanges,
events, kqop->nevents, &ts); events, kqop->nevents, &ts);
@ -246,26 +246,26 @@ kq_dispatch(void *arg, struct timeval *tv)
return (-1); return (-1);
} }
ev = (struct ompi_event *)events[i].udata; ev = (struct opal_event *)events[i].udata;
if (events[i].filter == EVFILT_READ) { if (events[i].filter == EVFILT_READ) {
which |= OMPI_EV_READ; which |= OPAL_EV_READ;
} else if (events[i].filter == EVFILT_WRITE) { } else if (events[i].filter == EVFILT_WRITE) {
which |= OMPI_EV_WRITE; which |= OPAL_EV_WRITE;
} else if (events[i].filter == EVFILT_SIGNAL) { } else if (events[i].filter == EVFILT_SIGNAL) {
which |= OMPI_EV_SIGNAL; which |= OPAL_EV_SIGNAL;
} }
if (!which) if (!which)
continue; continue;
if (!(ev->ev_events & OMPI_EV_PERSIST)) { if (!(ev->ev_events & OPAL_EV_PERSIST)) {
ev->ev_flags &= ~EVLIST_X_KQINKERNEL; ev->ev_flags &= ~EVLIST_X_KQINKERNEL;
ompi_event_del_i(ev); opal_event_del_i(ev);
} }
ompi_event_active_i(ev, which, opal_event_active_i(ev, which,
ev->ev_events & OMPI_EV_SIGNAL ? events[i].data : 1); ev->ev_events & OPAL_EV_SIGNAL ? events[i].data : 1);
} }
return (0); return (0);
@ -273,19 +273,19 @@ kq_dispatch(void *arg, struct timeval *tv)
static int static int
kq_add(void *arg, struct ompi_event *ev) kq_add(void *arg, struct opal_event *ev)
{ {
struct kqop *kqop = arg; struct kqop *kqop = arg;
struct kevent kev; struct kevent kev;
if (ev->ev_events & OMPI_EV_SIGNAL) { if (ev->ev_events & OPAL_EV_SIGNAL) {
int nsignal = OMPI_EVENT_SIGNAL(ev); int nsignal = OPAL_EVENT_SIGNAL(ev);
memset(&kev, 0, sizeof(kev)); memset(&kev, 0, sizeof(kev));
kev.ident = nsignal; kev.ident = nsignal;
kev.filter = EVFILT_SIGNAL; kev.filter = EVFILT_SIGNAL;
kev.flags = EV_ADD; kev.flags = EV_ADD;
if (!(ev->ev_events & OMPI_EV_PERSIST)) if (!(ev->ev_events & OPAL_EV_PERSIST))
kev.flags |= EV_ONESHOT; kev.flags |= EV_ONESHOT;
kev.udata = (void *) INTPTR(ev); kev.udata = (void *) INTPTR(ev);
@ -299,12 +299,12 @@ kq_add(void *arg, struct ompi_event *ev)
return (0); return (0);
} }
if (ev->ev_events & OMPI_EV_READ) { if (ev->ev_events & OPAL_EV_READ) {
memset(&kev, 0, sizeof(kev)); memset(&kev, 0, sizeof(kev));
kev.ident = ev->ev_fd; kev.ident = ev->ev_fd;
kev.filter = EVFILT_READ; kev.filter = EVFILT_READ;
kev.flags = EV_ADD; kev.flags = EV_ADD;
if (!(ev->ev_events & OMPI_EV_PERSIST)) if (!(ev->ev_events & OPAL_EV_PERSIST))
kev.flags |= EV_ONESHOT; kev.flags |= EV_ONESHOT;
kev.udata = (void *) INTPTR(ev); kev.udata = (void *) INTPTR(ev);
@ -314,12 +314,12 @@ kq_add(void *arg, struct ompi_event *ev)
ev->ev_flags |= EVLIST_X_KQINKERNEL; ev->ev_flags |= EVLIST_X_KQINKERNEL;
} }
if (ev->ev_events & OMPI_EV_WRITE) { if (ev->ev_events & OPAL_EV_WRITE) {
memset(&kev, 0, sizeof(kev)); memset(&kev, 0, sizeof(kev));
kev.ident = ev->ev_fd; kev.ident = ev->ev_fd;
kev.filter = EVFILT_WRITE; kev.filter = EVFILT_WRITE;
kev.flags = EV_ADD; kev.flags = EV_ADD;
if (!(ev->ev_events & OMPI_EV_PERSIST)) if (!(ev->ev_events & OPAL_EV_PERSIST))
kev.flags |= EV_ONESHOT; kev.flags |= EV_ONESHOT;
kev.udata = (void *) INTPTR(ev); kev.udata = (void *) INTPTR(ev);
@ -333,7 +333,7 @@ kq_add(void *arg, struct ompi_event *ev)
} }
static int static int
kq_del(void *arg, struct ompi_event *ev) kq_del(void *arg, struct opal_event *ev)
{ {
struct kqop *kqop = arg; struct kqop *kqop = arg;
struct kevent kev; struct kevent kev;
@ -341,8 +341,8 @@ kq_del(void *arg, struct ompi_event *ev)
if (!(ev->ev_flags & EVLIST_X_KQINKERNEL)) if (!(ev->ev_flags & EVLIST_X_KQINKERNEL))
return (0); return (0);
if (ev->ev_events & OMPI_EV_SIGNAL) { if (ev->ev_events & OPAL_EV_SIGNAL) {
int nsignal = OMPI_EVENT_SIGNAL(ev); int nsignal = OPAL_EVENT_SIGNAL(ev);
memset(&kev, 0, sizeof(kev)); memset(&kev, 0, sizeof(kev));
kev.ident = (int)signal; kev.ident = (int)signal;
@ -359,7 +359,7 @@ kq_del(void *arg, struct ompi_event *ev)
return (0); return (0);
} }
if (ev->ev_events & OMPI_EV_READ) { if (ev->ev_events & OPAL_EV_READ) {
memset(&kev, 0, sizeof(kev)); memset(&kev, 0, sizeof(kev));
kev.ident = ev->ev_fd; kev.ident = ev->ev_fd;
kev.filter = EVFILT_READ; kev.filter = EVFILT_READ;
@ -371,7 +371,7 @@ kq_del(void *arg, struct ompi_event *ev)
ev->ev_flags &= ~EVLIST_X_KQINKERNEL; ev->ev_flags &= ~EVLIST_X_KQINKERNEL;
} }
if (ev->ev_events & OMPI_EV_WRITE) { if (ev->ev_events & OPAL_EV_WRITE) {
memset(&kev, 0, sizeof(kev)); memset(&kev, 0, sizeof(kev));
kev.ident = ev->ev_fd; kev.ident = ev->ev_fd;
kev.filter = EVFILT_WRITE; kev.filter = EVFILT_WRITE;

Просмотреть файл

@ -59,29 +59,29 @@
#include "event.h" #include "event.h"
#include "util/output.h" #include "util/output.h"
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
#include "evsignal.h" #include "evsignal.h"
#endif #endif
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
extern struct ompi_event_list ompi_eventqueue; extern struct opal_event_list opal_eventqueue;
extern volatile sig_atomic_t ompi_evsignal_caught; extern volatile sig_atomic_t opal_evsignal_caught;
extern opal_mutex_t ompi_event_lock; extern opal_mutex_t opal_event_lock;
/* Open MPI: make this struct instance be static */ /* Open MPI: make this struct instance be static */
static struct pollop { static struct pollop {
int event_count; /* Highest number alloc */ int event_count; /* Highest number alloc */
struct pollfd *event_set; struct pollfd *event_set;
struct ompi_event **event_back; struct opal_event **event_back;
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
sigset_t evsigmask; sigset_t evsigmask;
#endif #endif
} pollop; } pollop;
static void *poll_init (void); static void *poll_init (void);
static int poll_add (void *, struct ompi_event *); static int poll_add (void *, struct opal_event *);
static int poll_del (void *, struct ompi_event *); static int poll_del (void *, struct opal_event *);
#if 0 #if 0
/* Open MPI: JMS As far as I can tell, this function is not used /* Open MPI: JMS As far as I can tell, this function is not used
anywhere */ anywhere */
@ -89,7 +89,7 @@ static int poll_recalc (void *, int);
#endif #endif
static int poll_dispatch (void *, struct timeval *); static int poll_dispatch (void *, struct timeval *);
const struct ompi_eventop ompi_pollops = { const struct opal_eventop opal_pollops = {
"poll", "poll",
poll_init, poll_init,
poll_add, poll_add,
@ -106,8 +106,8 @@ poll_init(void)
return (NULL); return (NULL);
memset(&pollop, 0, sizeof(pollop)); memset(&pollop, 0, sizeof(pollop));
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
ompi_evsignal_init(&pollop.evsigmask); opal_evsignal_init(&pollop.evsigmask);
#endif #endif
return (&pollop); return (&pollop);
} }
@ -123,9 +123,9 @@ poll_init(void)
static int static int
poll_recalc(void *arg, int max) poll_recalc(void *arg, int max)
{ {
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
struct pollop *pop = arg; struct pollop *pop = arg;
return (ompi_evsignal_recalc(&pop->evsigmask)); return (opal_evsignal_recalc(&pop->evsigmask));
#else #else
return (0); return (0);
#endif #endif
@ -136,12 +136,12 @@ static int
poll_dispatch(void *arg, struct timeval *tv) poll_dispatch(void *arg, struct timeval *tv)
{ {
int res, i, count, sec, nfds; int res, i, count, sec, nfds;
struct ompi_event *ev; struct opal_event *ev;
struct pollop *pop = arg; struct pollop *pop = arg;
count = pop->event_count; count = pop->event_count;
nfds = 0; nfds = 0;
TAILQ_FOREACH(ev, &ompi_eventqueue, ev_next) { TAILQ_FOREACH(ev, &opal_eventqueue, ev_next) {
if (nfds + 1 >= count) { if (nfds + 1 >= count) {
if (count < 256) if (count < 256)
count = 256; count = 256;
@ -156,14 +156,14 @@ poll_dispatch(void *arg, struct timeval *tv)
return (-1); return (-1);
} }
pop->event_back = realloc(pop->event_back, pop->event_back = realloc(pop->event_back,
count * sizeof(struct ompi_event *)); count * sizeof(struct opal_event *));
if (pop->event_back == NULL) { if (pop->event_back == NULL) {
log_error("realloc"); log_error("realloc");
return (-1); return (-1);
} }
pop->event_count = count; pop->event_count = count;
} }
if (ev->ev_events & OMPI_EV_WRITE) { if (ev->ev_events & OPAL_EV_WRITE) {
struct pollfd *pfd = &pop->event_set[nfds]; struct pollfd *pfd = &pop->event_set[nfds];
pfd->fd = ev->ev_fd; pfd->fd = ev->ev_fd;
pfd->events = POLLOUT; pfd->events = POLLOUT;
@ -173,7 +173,7 @@ poll_dispatch(void *arg, struct timeval *tv)
nfds++; nfds++;
} }
if (ev->ev_events & OMPI_EV_READ) { if (ev->ev_events & OPAL_EV_READ) {
struct pollfd *pfd = &pop->event_set[nfds]; struct pollfd *pfd = &pop->event_set[nfds];
pfd->fd = ev->ev_fd; pfd->fd = ev->ev_fd;
@ -186,18 +186,18 @@ poll_dispatch(void *arg, struct timeval *tv)
} }
} }
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
if (ompi_evsignal_deliver(&pop->evsigmask) == -1) if (opal_evsignal_deliver(&pop->evsigmask) == -1)
return (-1); return (-1);
#endif #endif
sec = tv->tv_sec * 1000 + tv->tv_usec / 1000; sec = tv->tv_sec * 1000 + tv->tv_usec / 1000;
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
res = poll(pop->event_set, nfds, sec); res = poll(pop->event_set, nfds, sec);
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
if (ompi_evsignal_recalc(&pop->evsigmask) == -1) if (opal_evsignal_recalc(&pop->evsigmask) == -1)
return (-1); return (-1);
#endif #endif
@ -207,15 +207,15 @@ poll_dispatch(void *arg, struct timeval *tv)
return (-1); return (-1);
} }
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
ompi_evsignal_process(); opal_evsignal_process();
#endif #endif
return (0); return (0);
} }
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
else if (ompi_evsignal_caught) else if (opal_evsignal_caught)
ompi_evsignal_process(); opal_evsignal_process();
#endif #endif
LOG_DBG((LOG_MISC, 80, "%s: poll reports %d", __func__, res)); LOG_DBG((LOG_MISC, 80, "%s: poll reports %d", __func__, res));
@ -232,9 +232,9 @@ poll_dispatch(void *arg, struct timeval *tv)
if (what & (POLLHUP | POLLERR | POLLNVAL)) if (what & (POLLHUP | POLLERR | POLLNVAL))
what |= POLLIN|POLLOUT; what |= POLLIN|POLLOUT;
if (what & POLLIN) if (what & POLLIN)
res |= OMPI_EV_READ; res |= OPAL_EV_READ;
if (what & POLLOUT) if (what & POLLOUT)
res |= OMPI_EV_WRITE; res |= OPAL_EV_WRITE;
if (res == 0) if (res == 0)
continue; continue;
@ -242,9 +242,9 @@ poll_dispatch(void *arg, struct timeval *tv)
res &= ev->ev_events; res &= ev->ev_events;
if (res) { if (res) {
if (!(ev->ev_events & OMPI_EV_PERSIST)) if (!(ev->ev_events & OPAL_EV_PERSIST))
ompi_event_del_i(ev); opal_event_del_i(ev);
ompi_event_active_i(ev, res, 1); opal_event_active_i(ev, res, 1);
} }
} }
@ -252,12 +252,12 @@ poll_dispatch(void *arg, struct timeval *tv)
} }
static int static int
poll_add(void *arg, struct ompi_event *ev) poll_add(void *arg, struct opal_event *ev)
{ {
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
struct pollop *pop = arg; struct pollop *pop = arg;
if (ev->ev_events & OMPI_EV_SIGNAL) if (ev->ev_events & OPAL_EV_SIGNAL)
return (ompi_evsignal_add(&pop->evsigmask, ev)); return (opal_evsignal_add(&pop->evsigmask, ev));
#endif #endif
return (0); return (0);
} }
@ -267,15 +267,15 @@ poll_add(void *arg, struct ompi_event *ev)
*/ */
static int static int
poll_del(void *arg, struct ompi_event *ev) poll_del(void *arg, struct opal_event *ev)
{ {
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
struct pollop *pop = arg; struct pollop *pop = arg;
#endif #endif
if (!(ev->ev_events & OMPI_EV_SIGNAL)) if (!(ev->ev_events & OPAL_EV_SIGNAL))
return (0); return (0);
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
return (ompi_evsignal_del(&pop->evsigmask, ev)); return (opal_evsignal_del(&pop->evsigmask, ev));
#else #else
return (0); return (0);
#endif #endif

Просмотреть файл

@ -127,7 +127,7 @@ static int rtsig_del(void *, struct event *);
static int rtsig_recalc(void *, int); static int rtsig_recalc(void *, int);
static int rtsig_dispatch(void *, struct timeval *); static int rtsig_dispatch(void *, struct timeval *);
struct ompi_eventop rtsigops = { struct opal_eventop rtsigops = {
"rtsig", "rtsig",
rtsig_init, rtsig_init,
rtsig_add, rtsig_add,

Просмотреть файл

@ -33,13 +33,13 @@ fifo_read(int fd, short event, void *arg)
{ {
char buf[255]; char buf[255];
int len; int len;
struct ompi_event *ev = arg; struct opal_event *ev = arg;
#ifdef WIN32 #ifdef WIN32
DWORD dwBytesRead; DWORD dwBytesRead;
#endif #endif
/* Reschedule this event */ /* Reschedule this event */
ompi_event_add(ev, NULL); opal_event_add(ev, NULL);
fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n", fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n",
fd, event, arg); fd, event, arg);
@ -49,7 +49,7 @@ fifo_read(int fd, short event, void *arg)
// Check for end of file. // Check for end of file.
if(len && dwBytesRead == 0) { if(len && dwBytesRead == 0) {
fprintf(stderr, "End Of File"); fprintf(stderr, "End Of File");
ompi_event_del(ev); opal_event_del(ev);
return; return;
} }
@ -73,7 +73,7 @@ fifo_read(int fd, short event, void *arg)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct ompi_event evfifo; struct opal_event evfifo;
#ifdef WIN32 #ifdef WIN32
HANDLE socket; HANDLE socket;
// Open a file. // Open a file.
@ -122,19 +122,19 @@ main (int argc, char **argv)
fprintf(stderr, "Write data to %s\n", fifo); fprintf(stderr, "Write data to %s\n", fifo);
#endif #endif
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
/* Initalize one event */ /* Initalize one event */
#ifdef WIN32 #ifdef WIN32
ompi_event_set(&evfifo, (int)socket, OMPI_EV_READ, fifo_read, &evfifo); opal_event_set(&evfifo, (int)socket, OPAL_EV_READ, fifo_read, &evfifo);
#else #else
ompi_event_set(&evfifo, socket, OMPI_EV_READ, fifo_read, &evfifo); opal_event_set(&evfifo, socket, OPAL_EV_READ, fifo_read, &evfifo);
#endif #endif
/* Add it to the active events, without a timeout */ /* Add it to the active events, without a timeout */
ompi_event_add(&evfifo, NULL); opal_event_add(&evfifo, NULL);
ompi_event_dispatch(); opal_event_dispatch();
#ifdef WIN32 #ifdef WIN32
CloseHandle(socket); CloseHandle(socket);
#endif #endif

Просмотреть файл

@ -34,12 +34,12 @@ int called = 0;
void void
signal_cb(int fd, short event, void *arg) signal_cb(int fd, short event, void *arg)
{ {
struct ompi_event *signal = arg; struct opal_event *signal = arg;
printf("%s: got signal %d\n", __func__, OMPI_EVENT_SIGNAL(signal)); printf("%s: got signal %d\n", __func__, OPAL_EVENT_SIGNAL(signal));
if (called >= 2) if (called >= 2)
ompi_event_del(signal); opal_event_del(signal);
called++; called++;
} }
@ -47,18 +47,18 @@ signal_cb(int fd, short event, void *arg)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct ompi_event signal_int; struct opal_event signal_int;
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
/* Initalize one event */ /* Initalize one event */
ompi_event_set(&signal_int, SIGINT, OMPI_EV_SIGNAL|OMPI_EV_PERSIST, signal_cb, opal_event_set(&signal_int, SIGINT, OPAL_EV_SIGNAL|OPAL_EV_PERSIST, signal_cb,
&signal_int); &signal_int);
ompi_event_add(&signal_int, NULL); opal_event_add(&signal_int, NULL);
ompi_event_dispatch(); opal_event_dispatch();
return (0); return (0);
} }

Просмотреть файл

@ -34,7 +34,7 @@ void
timeout_cb(int fd, short event, void *arg) timeout_cb(int fd, short event, void *arg)
{ {
struct timeval tv; struct timeval tv;
struct ompi_event *timeout = arg; struct opal_event *timeout = arg;
int newtime = time(NULL); int newtime = time(NULL);
printf("%s: called at %d: %d\n", __func__, newtime, printf("%s: called at %d: %d\n", __func__, newtime,
@ -43,28 +43,28 @@ timeout_cb(int fd, short event, void *arg)
timerclear(&tv); timerclear(&tv);
tv.tv_sec = 2; tv.tv_sec = 2;
ompi_event_add(timeout, &tv); opal_event_add(timeout, &tv);
} }
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct ompi_event timeout; struct opal_event timeout;
struct timeval tv; struct timeval tv;
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
/* Initalize one event */ /* Initalize one event */
ompi_evtimer_set(&timeout, timeout_cb, &timeout); opal_evtimer_set(&timeout, timeout_cb, &timeout);
timerclear(&tv); timerclear(&tv);
tv.tv_sec = 2; tv.tv_sec = 2;
ompi_event_add(&timeout, &tv); opal_event_add(&timeout, &tv);
lasttime = time(NULL); lasttime = time(NULL);
ompi_event_dispatch(); opal_event_dispatch();
return (0); return (0);
} }

Просмотреть файл

@ -57,20 +57,20 @@
#endif #endif
#include "event.h" #include "event.h"
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
#include "evsignal.h" #include "evsignal.h"
#endif #endif
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
extern struct ompi_event_list ompi_eventqueue; extern struct opal_event_list opal_eventqueue;
extern opal_mutex_t ompi_event_lock; extern opal_mutex_t opal_event_lock;
#ifndef howmany #ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y)) #define howmany(x, y) (((x)+((y)-1))/(y))
#endif #endif
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
extern volatile sig_atomic_t ompi_evsignal_caught; extern volatile sig_atomic_t opal_evsignal_caught;
#endif #endif
static struct selectop { static struct selectop {
@ -78,18 +78,18 @@ static struct selectop {
int event_fdsz; int event_fdsz;
fd_set *event_readset; fd_set *event_readset;
fd_set *event_writeset; fd_set *event_writeset;
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
sigset_t evsigmask; sigset_t evsigmask;
#endif #endif
} sop; } sop;
static void *select_init (void); static void *select_init (void);
static int select_add (void *, struct ompi_event *); static int select_add (void *, struct opal_event *);
static int select_del (void *, struct ompi_event *); static int select_del (void *, struct opal_event *);
static int select_recalc (void *, int); static int select_recalc (void *, int);
static int select_dispatch (void *, struct timeval *); static int select_dispatch (void *, struct timeval *);
const struct ompi_eventop ompi_selectops = { const struct opal_eventop opal_selectops = {
"select", "select",
select_init, select_init,
select_add, select_add,
@ -115,8 +115,8 @@ select_init(void)
sop.event_readset = malloc (sizeof(fd_set)); sop.event_readset = malloc (sizeof(fd_set));
sop.event_writeset = malloc (sizeof(fd_set)); sop.event_writeset = malloc (sizeof(fd_set));
#endif #endif
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
ompi_evsignal_init(&sop.evsigmask); opal_evsignal_init(&sop.evsigmask);
#endif #endif
return (&sop); return (&sop);
} }
@ -132,14 +132,14 @@ select_recalc(void *arg, int max)
{ {
struct selectop *sop = arg; struct selectop *sop = arg;
fd_set *readset, *writeset; fd_set *readset, *writeset;
struct ompi_event *ev; struct opal_event *ev;
int fdsz; int fdsz;
if (sop->event_fds < max) if (sop->event_fds < max)
sop->event_fds = max; sop->event_fds = max;
if (!sop->event_fds) { if (!sop->event_fds) {
TAILQ_FOREACH(ev, &ompi_eventqueue, ev_next) TAILQ_FOREACH(ev, &opal_eventqueue, ev_next)
if (ev->ev_fd > sop->event_fds) if (ev->ev_fd > sop->event_fds)
sop->event_fds = ev->ev_fd; sop->event_fds = ev->ev_fd;
} }
@ -166,8 +166,8 @@ select_recalc(void *arg, int max)
sop->event_writeset = writeset; sop->event_writeset = writeset;
sop->event_fdsz = fdsz; sop->event_fdsz = fdsz;
} }
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
return (ompi_evsignal_recalc(&sop->evsigmask)); return (opal_evsignal_recalc(&sop->evsigmask));
#else #else
return (0); return (0);
#endif #endif
@ -178,7 +178,7 @@ static int
select_dispatch(void *arg, struct timeval *tv) select_dispatch(void *arg, struct timeval *tv)
{ {
int maxfd, res; int maxfd, res;
struct ompi_event *ev, *next; struct opal_event *ev, *next;
struct selectop *sop = arg; struct selectop *sop = arg;
#ifndef WIN32 #ifndef WIN32
@ -186,26 +186,26 @@ select_dispatch(void *arg, struct timeval *tv)
memset(sop->event_writeset, 0, sop->event_fdsz); memset(sop->event_writeset, 0, sop->event_fdsz);
#endif #endif
TAILQ_FOREACH(ev, &ompi_eventqueue, ev_next) { TAILQ_FOREACH(ev, &opal_eventqueue, ev_next) {
if (ev->ev_events & OMPI_EV_WRITE) if (ev->ev_events & OPAL_EV_WRITE)
FD_SET(ev->ev_fd, sop->event_writeset); FD_SET(ev->ev_fd, sop->event_writeset);
if (ev->ev_events & OMPI_EV_READ) if (ev->ev_events & OPAL_EV_READ)
FD_SET(ev->ev_fd, sop->event_readset); FD_SET(ev->ev_fd, sop->event_readset);
} }
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
if (ompi_evsignal_deliver(&sop->evsigmask) == -1) if (opal_evsignal_deliver(&sop->evsigmask) == -1)
return (-1); return (-1);
#endif #endif
/* release lock while waiting in kernel */ /* release lock while waiting in kernel */
opal_mutex_unlock(&ompi_event_lock); opal_mutex_unlock(&opal_event_lock);
res = select(sop->event_fds + 1, sop->event_readset, res = select(sop->event_fds + 1, sop->event_readset,
sop->event_writeset, NULL, tv); sop->event_writeset, NULL, tv);
opal_mutex_lock(&ompi_event_lock); opal_mutex_lock(&opal_event_lock);
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
if (ompi_evsignal_recalc(&sop->evsigmask) == -1) if (opal_evsignal_recalc(&sop->evsigmask) == -1)
return (-1); return (-1);
#endif #endif
@ -214,22 +214,22 @@ select_dispatch(void *arg, struct timeval *tv)
/* poll each of the file descriptors individually to determine /* poll each of the file descriptors individually to determine
* which is bad * which is bad
*/ */
for (ev = TAILQ_FIRST(&ompi_eventqueue); ev != NULL; ev = next) { for (ev = TAILQ_FIRST(&opal_eventqueue); ev != NULL; ev = next) {
next = TAILQ_NEXT(ev, ev_next); next = TAILQ_NEXT(ev, ev_next);
tv->tv_sec = 0; tv->tv_sec = 0;
tv->tv_usec = 0; tv->tv_usec = 0;
memset(sop->event_readset, 0, sop->event_fdsz); memset(sop->event_readset, 0, sop->event_fdsz);
memset(sop->event_writeset, 0, sop->event_fdsz); memset(sop->event_writeset, 0, sop->event_fdsz);
if (ev->ev_events & OMPI_EV_WRITE) if (ev->ev_events & OPAL_EV_WRITE)
FD_SET(ev->ev_fd, sop->event_writeset); FD_SET(ev->ev_fd, sop->event_writeset);
if (ev->ev_events & OMPI_EV_READ) if (ev->ev_events & OPAL_EV_READ)
FD_SET(ev->ev_fd, sop->event_readset); FD_SET(ev->ev_fd, sop->event_readset);
res = select(sop->event_fds + 1, sop->event_readset, res = select(sop->event_fds + 1, sop->event_readset,
sop->event_writeset, NULL, tv); sop->event_writeset, NULL, tv);
if(res < 0) { if(res < 0) {
ompi_output(0, "bad file descriptor: %d\n", ev->ev_fd); ompi_output(0, "bad file descriptor: %d\n", ev->ev_fd);
ompi_event_del_i(ev); opal_event_del_i(ev);
} }
} }
} }
@ -238,32 +238,32 @@ select_dispatch(void *arg, struct timeval *tv)
return (-1); return (-1);
} }
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
ompi_evsignal_process(); opal_evsignal_process();
#endif #endif
return (0); return (0);
} }
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
else if (ompi_evsignal_caught) else if (opal_evsignal_caught)
ompi_evsignal_process(); opal_evsignal_process();
#endif #endif
maxfd = 0; maxfd = 0;
for (ev = TAILQ_FIRST(&ompi_eventqueue); ev != NULL; ev = next) { for (ev = TAILQ_FIRST(&opal_eventqueue); ev != NULL; ev = next) {
next = TAILQ_NEXT(ev, ev_next); next = TAILQ_NEXT(ev, ev_next);
res = 0; res = 0;
if (FD_ISSET(ev->ev_fd, sop->event_readset)) if (FD_ISSET(ev->ev_fd, sop->event_readset))
res |= OMPI_EV_READ; res |= OPAL_EV_READ;
if (FD_ISSET(ev->ev_fd, sop->event_writeset)) if (FD_ISSET(ev->ev_fd, sop->event_writeset))
res |= OMPI_EV_WRITE; res |= OPAL_EV_WRITE;
res &= ev->ev_events; res &= ev->ev_events;
if (res) { if (res) {
if (!(ev->ev_events & OMPI_EV_PERSIST)) if (!(ev->ev_events & OPAL_EV_PERSIST))
ompi_event_del_i(ev); opal_event_del_i(ev);
ompi_event_active_i(ev, res, 1); opal_event_active_i(ev, res, 1);
} }
if ((ev->ev_flags & ~OMPI_EVLIST_ACTIVE) == 0 && ev->ev_fd > maxfd) if ((ev->ev_flags & ~OPAL_EVLIST_ACTIVE) == 0 && ev->ev_fd > maxfd)
maxfd = ev->ev_fd; maxfd = ev->ev_fd;
} }
@ -272,13 +272,13 @@ select_dispatch(void *arg, struct timeval *tv)
} }
static int static int
select_add(void *arg, struct ompi_event *ev) select_add(void *arg, struct opal_event *ev)
{ {
struct selectop *sop = arg; struct selectop *sop = arg;
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
if (ev->ev_events & OMPI_EV_SIGNAL) if (ev->ev_events & OPAL_EV_SIGNAL)
return (ompi_evsignal_add(&sop->evsigmask, ev)); return (opal_evsignal_add(&sop->evsigmask, ev));
#endif #endif
/* /*
@ -296,15 +296,15 @@ select_add(void *arg, struct ompi_event *ev)
*/ */
static int static int
select_del(void *arg, struct ompi_event *ev) select_del(void *arg, struct opal_event *ev)
{ {
#if OMPI_EVENT_USE_SIGNALS #if OPAL_EVENT_USE_SIGNALS
struct selectop *sop = arg; struct selectop *sop = arg;
if (!(ev->ev_events & OMPI_EV_SIGNAL)) if (!(ev->ev_events & OPAL_EV_SIGNAL))
return (0); return (0);
return (ompi_evsignal_del(&sop->evsigmask, ev)); return (opal_evsignal_del(&sop->evsigmask, ev));
#else #else
return (0); return (0);
#endif #endif

Просмотреть файл

@ -59,33 +59,33 @@
#include "evsignal.h" #include "evsignal.h"
#include "util/output.h" #include "util/output.h"
extern struct ompi_event_list ompi_signalqueue; extern struct opal_event_list opal_signalqueue;
static short ompi_evsigcaught[NSIG]; static short opal_evsigcaught[NSIG];
static int ompi_needrecalc; static int opal_needrecalc;
#if 0 #if 0
static int ompi_event_signal_pipe[2]; static int opal_event_signal_pipe[2];
static ompi_event_t ompi_event_signal_pipe_event; static opal_event_t opal_event_signal_pipe_event;
#endif #endif
volatile sig_atomic_t ompi_event_signal_count = 0; volatile sig_atomic_t opal_event_signal_count = 0;
static bool initialized = false; static bool initialized = false;
volatile sig_atomic_t ompi_evsignal_caught = 0; volatile sig_atomic_t opal_evsignal_caught = 0;
#if 0 #if 0
static void ompi_event_signal_pipe_handler(int sd, short flags, void* user) static void opal_event_signal_pipe_handler(int sd, short flags, void* user)
{ {
ompi_output(0, "ompi_event_signal_pipe_handler: %d\n", ompi_event_signal_count); ompi_output(0, "opal_event_signal_pipe_handler: %d\n", opal_event_signal_count);
while(ompi_event_signal_count-- > 0) { while(opal_event_signal_count-- > 0) {
char byte; char byte;
read(ompi_event_signal_pipe[0], &byte, 1); read(opal_event_signal_pipe[0], &byte, 1);
} }
} }
#endif #endif
void ompi_evsignal_handler(int sig); void opal_evsignal_handler(int sig);
void void
ompi_evsignal_init(sigset_t *evsigmask) opal_evsignal_init(sigset_t *evsigmask)
{ {
#ifndef WIN32 #ifndef WIN32
sigemptyset(evsigmask); sigemptyset(evsigmask);
@ -94,35 +94,35 @@ ompi_evsignal_init(sigset_t *evsigmask)
int int
ompi_evsignal_add(sigset_t *evsigmask, struct ompi_event *ev) opal_evsignal_add(sigset_t *evsigmask, struct opal_event *ev)
{ {
int evsignal; int evsignal;
if (!initialized) { if (!initialized) {
ompi_event_signal_count = 0; opal_event_signal_count = 0;
#if 0 #if 0
/* Must delay the event add until after init() because /* Must delay the event add until after init() because
it may trigger poll events that are not yet setup it may trigger poll events that are not yet setup
to be triggered. */ to be triggered. */
pipe(ompi_event_signal_pipe); pipe(opal_event_signal_pipe);
ompi_event_set(&ompi_event_signal_pipe_event, opal_event_set(&opal_event_signal_pipe_event,
ompi_event_signal_pipe[0], opal_event_signal_pipe[0],
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
ompi_event_signal_pipe_handler, opal_event_signal_pipe_handler,
0); 0);
ompi_event_add_i(&ompi_event_signal_pipe_event, 0); opal_event_add_i(&opal_event_signal_pipe_event, 0);
#endif #endif
initialized = true; initialized = true;
} }
if (ev->ev_events & (OMPI_EV_READ|OMPI_EV_WRITE)) if (ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE))
errx(1, "%s: OMPI_EV_SIGNAL incompatible use", __func__); errx(1, "%s: OPAL_EV_SIGNAL incompatible use", __func__);
evsignal = OMPI_EVENT_SIGNAL(ev); evsignal = OPAL_EVENT_SIGNAL(ev);
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
if (!opal_using_threads()) ompi_event_loop(OMPI_EVLOOP_NONBLOCK); if (!opal_using_threads()) opal_event_loop(OPAL_EVLOOP_NONBLOCK);
#else #else
ompi_event_loop(OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_NONBLOCK);
#endif #endif
#ifndef WIN32 #ifndef WIN32
@ -132,22 +132,22 @@ ompi_evsignal_add(sigset_t *evsigmask, struct ompi_event *ev)
} }
int int
ompi_evsignal_restart(void) opal_evsignal_restart(void)
{ {
if(initialized) { if(initialized) {
ompi_event_signal_count = 0; opal_event_signal_count = 0;
#if 0 #if 0
int rc; int rc;
ompi_event_del_i(&ompi_event_signal_pipe_event); opal_event_del_i(&opal_event_signal_pipe_event);
if ((rc = pipe(ompi_event_signal_pipe)) != 0) { if ((rc = pipe(opal_event_signal_pipe)) != 0) {
return rc; return rc;
} }
ompi_event_set(&ompi_event_signal_pipe_event, opal_event_set(&opal_event_signal_pipe_event,
ompi_event_signal_pipe[0], opal_event_signal_pipe[0],
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
ompi_event_signal_pipe_handler, opal_event_signal_pipe_handler,
0); 0);
ompi_event_add_i(&ompi_event_signal_pipe_event, 0); opal_event_add_i(&opal_event_signal_pipe_event, 0);
#endif #endif
} }
return (0); return (0);
@ -158,7 +158,7 @@ ompi_evsignal_restart(void)
*/ */
int int
ompi_evsignal_del(sigset_t *evsigmask, struct ompi_event *ev) opal_evsignal_del(sigset_t *evsigmask, struct opal_event *ev)
{ {
#ifdef WIN32 #ifdef WIN32
return 0; return 0;
@ -166,9 +166,9 @@ ompi_evsignal_del(sigset_t *evsigmask, struct ompi_event *ev)
int evsignal; int evsignal;
struct sigaction sa; struct sigaction sa;
evsignal = OMPI_EVENT_SIGNAL(ev); evsignal = OPAL_EVENT_SIGNAL(ev);
sigdelset(evsigmask, evsignal); sigdelset(evsigmask, evsignal);
ompi_needrecalc = 1; opal_needrecalc = 1;
memset(&sa, 0, sizeof(sa)); memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_DFL; sa.sa_handler = SIG_DFL;
@ -178,49 +178,49 @@ ompi_evsignal_del(sigset_t *evsigmask, struct ompi_event *ev)
} }
void void
ompi_evsignal_handler(int sig) opal_evsignal_handler(int sig)
{ {
#if 0 #if 0
unsigned char byte = 0; unsigned char byte = 0;
#endif #endif
ompi_evsigcaught[sig]++; opal_evsigcaught[sig]++;
ompi_evsignal_caught = 1; opal_evsignal_caught = 1;
#if 0 #if 0
if(ompi_event_signal_count == 0) { if(opal_event_signal_count == 0) {
ompi_event_signal_count++; opal_event_signal_count++;
write(ompi_event_signal_pipe[1], &byte, 1); write(opal_event_signal_pipe[1], &byte, 1);
} }
#endif #endif
} }
int int
ompi_evsignal_recalc(sigset_t *evsigmask) opal_evsignal_recalc(sigset_t *evsigmask)
{ {
#ifdef WIN32 #ifdef WIN32
return 0; return 0;
#else #else
struct sigaction sa; struct sigaction sa;
struct ompi_event *ev; struct opal_event *ev;
if (TAILQ_FIRST(&ompi_signalqueue) == NULL && !ompi_needrecalc) if (TAILQ_FIRST(&opal_signalqueue) == NULL && !opal_needrecalc)
return (0); return (0);
ompi_needrecalc = 0; opal_needrecalc = 0;
if (sigprocmask(SIG_BLOCK, evsigmask, NULL) == -1) if (sigprocmask(SIG_BLOCK, evsigmask, NULL) == -1)
return (-1); return (-1);
/* Reinstall our signal handler. */ /* Reinstall our signal handler. */
memset(&sa, 0, sizeof(sa)); memset(&sa, 0, sizeof(sa));
sa.sa_handler = ompi_evsignal_handler; sa.sa_handler = opal_evsignal_handler;
sa.sa_mask = *evsigmask; sa.sa_mask = *evsigmask;
#if OMPI_HAVE_SA_RESTART #if OMPI_HAVE_SA_RESTART
sa.sa_flags |= SA_RESTART; sa.sa_flags |= SA_RESTART;
#endif #endif
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) { TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
if (sigaction(OMPI_EVENT_SIGNAL(ev), &sa, NULL) == -1) if (sigaction(OPAL_EVENT_SIGNAL(ev), &sa, NULL) == -1)
return (-1); return (-1);
} }
return (0); return (0);
@ -228,9 +228,9 @@ ompi_evsignal_recalc(sigset_t *evsigmask)
} }
int int
ompi_evsignal_deliver(sigset_t *evsigmask) opal_evsignal_deliver(sigset_t *evsigmask)
{ {
if (TAILQ_FIRST(&ompi_signalqueue) == NULL) if (TAILQ_FIRST(&opal_signalqueue) == NULL)
return (0); return (0);
#ifdef WIN32 #ifdef WIN32
@ -242,21 +242,21 @@ ompi_evsignal_deliver(sigset_t *evsigmask)
} }
void void
ompi_evsignal_process(void) opal_evsignal_process(void)
{ {
struct ompi_event *ev; struct opal_event *ev;
short ncalls; short ncalls;
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) { TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
ncalls = ompi_evsigcaught[OMPI_EVENT_SIGNAL(ev)]; ncalls = opal_evsigcaught[OPAL_EVENT_SIGNAL(ev)];
if (ncalls) { if (ncalls) {
if (!(ev->ev_events & OMPI_EV_PERSIST)) if (!(ev->ev_events & OPAL_EV_PERSIST))
ompi_event_del_i(ev); opal_event_del_i(ev);
ompi_event_active_i(ev, OMPI_EV_SIGNAL, ncalls); opal_event_active_i(ev, OPAL_EV_SIGNAL, ncalls);
} }
} }
memset(ompi_evsigcaught, 0, sizeof(ompi_evsigcaught)); memset(opal_evsigcaught, 0, sizeof(opal_evsigcaught));
ompi_evsignal_caught = 0; opal_evsignal_caught = 0;
} }

Просмотреть файл

@ -16,13 +16,13 @@
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO OMPI_EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * IN NO OPAL_EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWLAM_EVER CAUSED AND ON ANY * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWLAM_EVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, OMPI_EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, OPAL_EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* *
* Mon 03/10/2003 - Modified by Davide Libenzi <davidel@xmailserver.org> * Mon 03/10/2003 - Modified by Davide Libenzi <davidel@xmailserver.org>
@ -66,7 +66,7 @@
static int count, writes, fired; static int count, writes, fired;
static int *pipes; static int *pipes;
static int num_pipes, num_active, num_writes; static int num_pipes, num_active, num_writes;
static struct ompi_event *events; static struct opal_event *events;
@ -93,12 +93,12 @@ run_once(void)
static struct timeval ts, te; static struct timeval ts, te;
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) { for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
ompi_event_del(&events[i]); opal_event_del(&events[i]);
ompi_event_set(&events[i], cp[0], OMPI_EV_READ | OMPI_EV_PERSIST, read_cb, (void *) i); opal_event_set(&events[i], cp[0], OPAL_EV_READ | OPAL_EV_PERSIST, read_cb, (void *) i);
ompi_event_add(&events[i], NULL); opal_event_add(&events[i], NULL);
} }
ompi_event_loop(OMPI_EVLOOP_ONCE | OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_ONCE | OPAL_EVLOOP_NONBLOCK);
fired = 0; fired = 0;
space = num_pipes / num_active; space = num_pipes / num_active;
@ -111,7 +111,7 @@ run_once(void)
{ int xcount = 0; { int xcount = 0;
gettimeofday(&ts, NULL); gettimeofday(&ts, NULL);
do { do {
ompi_event_loop(OMPI_EVLOOP_ONCE | OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_ONCE | OPAL_EVLOOP_NONBLOCK);
xcount++; xcount++;
} while (count != fired); } while (count != fired);
gettimeofday(&te, NULL); gettimeofday(&te, NULL);
@ -159,14 +159,14 @@ main (int argc, char **argv)
exit(1); exit(1);
} }
events = calloc(num_pipes, sizeof(struct ompi_event)); events = calloc(num_pipes, sizeof(struct opal_event));
pipes = calloc(num_pipes * 2, sizeof(int)); pipes = calloc(num_pipes * 2, sizeof(int));
if (events == NULL || pipes == NULL) { if (events == NULL || pipes == NULL) {
perror("malloc"); perror("malloc");
exit(1); exit(1);
} }
ompi_event_init(); opal_event_init();
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) { for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
#ifdef USE_PIPES #ifdef USE_PIPES

Просмотреть файл

@ -75,7 +75,7 @@ simple_read_cb(int fd, short event, void *arg)
if (len) { if (len) {
if (!called) if (!called)
ompi_event_add(arg, NULL); opal_event_add(arg, NULL);
} else if (called == 1) } else if (called == 1)
test_ok = 1; test_ok = 1;
@ -97,7 +97,7 @@ simple_write_cb(int fd, short event, void *arg)
void void
multiple_write_cb(int fd, short event, void *arg) multiple_write_cb(int fd, short event, void *arg)
{ {
struct ompi_event *ev = arg; struct opal_event *ev = arg;
int len; int len;
len = 128; len = 128;
@ -108,7 +108,7 @@ multiple_write_cb(int fd, short event, void *arg)
if (len == -1) { if (len == -1) {
fprintf(stderr, "%s: write\n", __func__); fprintf(stderr, "%s: write\n", __func__);
if (usepersist) if (usepersist)
ompi_event_del(ev); opal_event_del(ev);
return; return;
} }
@ -117,18 +117,18 @@ multiple_write_cb(int fd, short event, void *arg)
if (woff >= sizeof(wbuf)) { if (woff >= sizeof(wbuf)) {
shutdown(fd, SHUT_WR); shutdown(fd, SHUT_WR);
if (usepersist) if (usepersist)
ompi_event_del(ev); opal_event_del(ev);
return; return;
} }
if (!usepersist) if (!usepersist)
ompi_event_add(ev, NULL); opal_event_add(ev, NULL);
} }
void void
multiple_read_cb(int fd, short event, void *arg) multiple_read_cb(int fd, short event, void *arg)
{ {
struct ompi_event *ev = arg; struct opal_event *ev = arg;
int len; int len;
len = read(fd, rbuf + roff, sizeof(rbuf) - roff); len = read(fd, rbuf + roff, sizeof(rbuf) - roff);
@ -136,13 +136,13 @@ multiple_read_cb(int fd, short event, void *arg)
fprintf(stderr, "%s: read\n", __func__); fprintf(stderr, "%s: read\n", __func__);
if (len <= 0) { if (len <= 0) {
if (usepersist) if (usepersist)
ompi_event_del(ev); opal_event_del(ev);
return; return;
} }
roff += len; roff += len;
if (!usepersist) if (!usepersist)
ompi_event_add(ev, NULL); opal_event_add(ev, NULL);
} }
void void
@ -168,14 +168,14 @@ timeout_cb(int fd, short event, void *arg)
void void
signal_cb(int fd, short event, void *arg) signal_cb(int fd, short event, void *arg)
{ {
struct ompi_event *ev = arg; struct opal_event *ev = arg;
ompi_signal_del(ev); opal_signal_del(ev);
test_ok = 1; test_ok = 1;
} }
struct both { struct both {
struct ompi_event ev; struct opal_event ev;
int nread; int nread;
}; };
@ -193,7 +193,7 @@ combined_read_cb(int fd, short event, void *arg)
return; return;
both->nread += len; both->nread += len;
ompi_event_add(&both->ev, NULL); opal_event_add(&both->ev, NULL);
} }
void void
@ -216,7 +216,7 @@ combined_write_cb(int fd, short event, void *arg)
} }
both->nread -= len; both->nread -= len;
ompi_event_add(&both->ev, NULL); opal_event_add(&both->ev, NULL);
} }
/* Test infrastructure */ /* Test infrastructure */
@ -256,7 +256,7 @@ cleanup_test(void)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct ompi_event ev, ev2; struct opal_event ev, ev2;
struct timeval tv; struct timeval tv;
struct itimerval itv; struct itimerval itv;
struct both r1, r2, w1, w2; struct both r1, r2, w1, w2;
@ -265,7 +265,7 @@ main (int argc, char **argv)
setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0);
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
/* Very simple read test */ /* Very simple read test */
setup_test("Simple read: "); setup_test("Simple read: ");
@ -273,18 +273,18 @@ main (int argc, char **argv)
write(pair[0], TEST1, strlen(TEST1)+1); write(pair[0], TEST1, strlen(TEST1)+1);
shutdown(pair[0], SHUT_WR); shutdown(pair[0], SHUT_WR);
ompi_event_set(&ev, pair[1], OMPI_EV_READ, simple_read_cb, &ev); opal_event_set(&ev, pair[1], OPAL_EV_READ, simple_read_cb, &ev);
ompi_event_add(&ev, NULL); opal_event_add(&ev, NULL);
ompi_event_dispatch(); opal_event_dispatch();
cleanup_test(); cleanup_test();
/* Very simple write test */ /* Very simple write test */
setup_test("Simple write: "); setup_test("Simple write: ");
ompi_event_set(&ev, pair[0], OMPI_EV_WRITE, simple_write_cb, &ev); opal_event_set(&ev, pair[0], OPAL_EV_WRITE, simple_write_cb, &ev);
ompi_event_add(&ev, NULL); opal_event_add(&ev, NULL);
ompi_event_dispatch(); opal_event_dispatch();
cleanup_test(); cleanup_test();
@ -297,11 +297,11 @@ main (int argc, char **argv)
roff = woff = 0; roff = woff = 0;
usepersist = 0; usepersist = 0;
ompi_event_set(&ev, pair[0], OMPI_EV_WRITE, multiple_write_cb, &ev); opal_event_set(&ev, pair[0], OPAL_EV_WRITE, multiple_write_cb, &ev);
ompi_event_add(&ev, NULL); opal_event_add(&ev, NULL);
ompi_event_set(&ev2, pair[1], OMPI_EV_READ, multiple_read_cb, &ev2); opal_event_set(&ev2, pair[1], OPAL_EV_READ, multiple_read_cb, &ev2);
ompi_event_add(&ev2, NULL); opal_event_add(&ev2, NULL);
ompi_event_dispatch(); opal_event_dispatch();
if (roff == woff) if (roff == woff)
test_ok = memcmp(rbuf, wbuf, sizeof(wbuf)) == 0; test_ok = memcmp(rbuf, wbuf, sizeof(wbuf)) == 0;
@ -317,11 +317,11 @@ main (int argc, char **argv)
roff = woff = 0; roff = woff = 0;
usepersist = 1; usepersist = 1;
ompi_event_set(&ev, pair[0], OMPI_EV_WRITE|OMPI_EV_PERSIST, multiple_write_cb, &ev); opal_event_set(&ev, pair[0], OPAL_EV_WRITE|OPAL_EV_PERSIST, multiple_write_cb, &ev);
ompi_event_add(&ev, NULL); opal_event_add(&ev, NULL);
ompi_event_set(&ev2, pair[1], OMPI_EV_READ|OMPI_EV_PERSIST, multiple_read_cb, &ev2); opal_event_set(&ev2, pair[1], OPAL_EV_READ|OPAL_EV_PERSIST, multiple_read_cb, &ev2);
ompi_event_add(&ev2, NULL); opal_event_add(&ev2, NULL);
ompi_event_dispatch(); opal_event_dispatch();
if (roff == woff) if (roff == woff)
test_ok = memcmp(rbuf, wbuf, sizeof(wbuf)) == 0; test_ok = memcmp(rbuf, wbuf, sizeof(wbuf)) == 0;
@ -337,16 +337,16 @@ main (int argc, char **argv)
w1.nread = 4096; w1.nread = 4096;
w2.nread = 8192; w2.nread = 8192;
ompi_event_set(&r1.ev, pair[0], OMPI_EV_READ, combined_read_cb, &r1); opal_event_set(&r1.ev, pair[0], OPAL_EV_READ, combined_read_cb, &r1);
ompi_event_set(&w1.ev, pair[0], OMPI_EV_WRITE, combined_write_cb, &w1); opal_event_set(&w1.ev, pair[0], OPAL_EV_WRITE, combined_write_cb, &w1);
ompi_event_set(&r2.ev, pair[1], OMPI_EV_READ, combined_read_cb, &r2); opal_event_set(&r2.ev, pair[1], OPAL_EV_READ, combined_read_cb, &r2);
ompi_event_set(&w2.ev, pair[1], OMPI_EV_WRITE, combined_write_cb, &w2); opal_event_set(&w2.ev, pair[1], OPAL_EV_WRITE, combined_write_cb, &w2);
ompi_event_add(&r1.ev, NULL); opal_event_add(&r1.ev, NULL);
ompi_event_add(&w1.ev, NULL); opal_event_add(&w1.ev, NULL);
ompi_event_add(&r2.ev, NULL); opal_event_add(&r2.ev, NULL);
ompi_event_add(&w2.ev, NULL); opal_event_add(&w2.ev, NULL);
ompi_event_dispatch(); opal_event_dispatch();
if (r1.nread == 8192 && r2.nread == 4096) if (r1.nread == 8192 && r2.nread == 4096)
test_ok = 1; test_ok = 1;
@ -358,26 +358,26 @@ main (int argc, char **argv)
tv.tv_usec = 0; tv.tv_usec = 0;
tv.tv_sec = SECONDS; tv.tv_sec = SECONDS;
ompi_evtimer_set(&ev, timeout_cb, NULL); opal_evtimer_set(&ev, timeout_cb, NULL);
ompi_evtimer_add(&ev, &tv); opal_evtimer_add(&ev, &tv);
gettimeofday(&tset, NULL); gettimeofday(&tset, NULL);
ompi_event_dispatch(); opal_event_dispatch();
cleanup_test(); cleanup_test();
setup_test("Simple signal: "); setup_test("Simple signal: ");
ompi_signal_set(&ev, SIGALRM, signal_cb, &ev); opal_signal_set(&ev, SIGALRM, signal_cb, &ev);
ompi_signal_add(&ev, NULL); opal_signal_add(&ev, NULL);
memset(&itv, 0, sizeof(itv)); memset(&itv, 0, sizeof(itv));
itv.it_value.tv_sec = 1; itv.it_value.tv_sec = 1;
if (setitimer(ITIMER_REAL, &itv, NULL) == -1) if (setitimer(ITIMER_REAL, &itv, NULL) == -1)
goto skip_simplesignal; goto skip_simplesignal;
ompi_event_dispatch(); opal_event_dispatch();
skip_simplesignal: skip_simplesignal:
ompi_signal_del(&ev); opal_signal_del(&ev);
cleanup_test(); cleanup_test();

Просмотреть файл

@ -40,7 +40,7 @@ read_cb(int fd, short event, void *arg)
if (len) { if (len) {
if (!called) if (!called)
ompi_event_add(arg, NULL); opal_event_add(arg, NULL);
} else if (called == 1) } else if (called == 1)
test_okay = 0; test_okay = 0;
@ -50,7 +50,7 @@ read_cb(int fd, short event, void *arg)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct ompi_event ev; struct opal_event ev;
char *test = "test string"; char *test = "test string";
int pair[2]; int pair[2];
@ -62,14 +62,14 @@ main (int argc, char **argv)
shutdown(pair[0], SHUT_WR); shutdown(pair[0], SHUT_WR);
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
/* Initalize one event */ /* Initalize one event */
ompi_event_set(&ev, pair[1], OMPI_EV_READ, read_cb, &ev); opal_event_set(&ev, pair[1], OPAL_EV_READ, read_cb, &ev);
ompi_event_add(&ev, NULL); opal_event_add(&ev, NULL);
ompi_event_dispatch(); opal_event_dispatch();
return (test_okay); return (test_okay);
} }

Просмотреть файл

@ -28,7 +28,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
return (0); return (0);
} }

Просмотреть файл

@ -25,7 +25,7 @@ int called = 0;
#define NEVENT 20000 #define NEVENT 20000
struct ompi_event *ev[NEVENT]; struct opal_event *ev[NEVENT];
void void
time_cb(int fd, short event, void *arg) time_cb(int fd, short event, void *arg)
@ -41,9 +41,9 @@ time_cb(int fd, short event, void *arg)
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = random() % 50000L; tv.tv_usec = random() % 50000L;
if (tv.tv_usec % 2) if (tv.tv_usec % 2)
ompi_evtimer_add(ev[j], &tv); opal_evtimer_add(ev[j], &tv);
else else
ompi_evtimer_del(ev[j]); opal_evtimer_del(ev[j]);
} }
} }
} }
@ -55,19 +55,19 @@ main (int argc, char **argv)
int i; int i;
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
for (i = 0; i < NEVENT; i++) { for (i = 0; i < NEVENT; i++) {
ev[i] = malloc(sizeof(struct ompi_event)); ev[i] = malloc(sizeof(struct opal_event));
/* Initalize one event */ /* Initalize one event */
ompi_evtimer_set(ev[i], time_cb, ev[i]); opal_evtimer_set(ev[i], time_cb, ev[i]);
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = random() % 50000L; tv.tv_usec = random() % 50000L;
ompi_evtimer_add(ev[i], &tv); opal_evtimer_add(ev[i], &tv);
} }
ompi_event_dispatch(); opal_event_dispatch();
return (called < NEVENT); return (called < NEVENT);
} }

Просмотреть файл

@ -42,7 +42,7 @@ write_cb(int fd, short event, void *arg)
if (len > 0) { if (len > 0) {
if (!called) if (!called)
ompi_event_add(arg, NULL); opal_event_add(arg, NULL);
close(pair[0]); close(pair[0]);
} else if (called == 1) } else if (called == 1)
test_okay = 0; test_okay = 0;
@ -53,7 +53,7 @@ write_cb(int fd, short event, void *arg)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
struct ompi_event ev; struct opal_event ev;
if (signal(SIGPIPE, SIG_IGN) == SIG_IGN) if (signal(SIGPIPE, SIG_IGN) == SIG_IGN)
return (1); return (1);
@ -62,12 +62,12 @@ main (int argc, char **argv)
return (1); return (1);
/* Initalize the event library */ /* Initalize the event library */
ompi_event_init(); opal_event_init();
/* Initalize one event */ /* Initalize one event */
ompi_event_set(&ev, pair[1], OMPI_EV_WRITE, write_cb, &ev); opal_event_set(&ev, pair[1], OPAL_EV_WRITE, write_cb, &ev);
ompi_event_add(&ev, NULL); opal_event_add(&ev, NULL);
ompi_event_dispatch(); opal_event_dispatch();
return (test_okay); return (test_okay);
} }

Просмотреть файл

@ -21,14 +21,14 @@
#endif #endif
#include "opal/runtime/opal_progress.h" #include "opal/runtime/opal_progress.h"
#include "event/event.h" #include "opal/event/event.h"
#include "include/constants.h" #include "include/constants.h"
#include "mca/base/mca_base_param.h" #include "mca/base/mca_base_param.h"
/* /*
* default parameters * default parameters
*/ */
static int opal_progress_event_flag = OMPI_EVLOOP_ONCE; static int opal_progress_event_flag = OPAL_EVLOOP_ONCE;
static const int opal_progress_default_tick_rate = 100; static const int opal_progress_default_tick_rate = 100;
/* /*
@ -208,7 +208,7 @@ opal_progress(void)
if (event_progress_counter-- <= 0 && opal_progress_event_flag != 0) { if (event_progress_counter-- <= 0 && opal_progress_event_flag != 0) {
event_progress_counter = event_progress_counter =
(event_num_mpi_users > 0) ? 1 : event_progress_counter_reset; (event_num_mpi_users > 0) ? 1 : event_progress_counter_reset;
events += ompi_event_loop(opal_progress_event_flag); events += opal_event_loop(opal_progress_event_flag);
} }
#endif #endif

Просмотреть файл

@ -19,7 +19,7 @@
#include <stdio.h> #include <stdio.h>
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/mca.h" #include "mca/mca.h"
#include "mca/base/base.h" #include "mca/base/base.h"
#include "mca/iof/iof.h" #include "mca/iof/iof.h"

Просмотреть файл

@ -44,7 +44,7 @@ static void orte_iof_base_endpoint_construct(orte_iof_base_endpoint_t* endpoint)
static void orte_iof_base_endpoint_destruct(orte_iof_base_endpoint_t* endpoint) static void orte_iof_base_endpoint_destruct(orte_iof_base_endpoint_t* endpoint)
{ {
if(endpoint->ep_fd >= 0) { if(endpoint->ep_fd >= 0) {
ompi_event_del(&endpoint->ep_event); opal_event_del(&endpoint->ep_event);
} }
OBJ_DESTRUCT(&endpoint->ep_frags); OBJ_DESTRUCT(&endpoint->ep_frags);
} }
@ -127,7 +127,7 @@ static void orte_iof_base_endpoint_read_handler(int fd, short flags, void *cbdat
/* if window size has been exceeded - disable forwarding */ /* if window size has been exceeded - disable forwarding */
endpoint->ep_seq += frag->frag_len; endpoint->ep_seq += frag->frag_len;
if(ORTE_IOF_BASE_SEQDIFF(endpoint->ep_seq,endpoint->ep_ack) > orte_iof_base.iof_window_size) { if(ORTE_IOF_BASE_SEQDIFF(endpoint->ep_seq,endpoint->ep_ack) > orte_iof_base.iof_window_size) {
ompi_event_del(&endpoint->ep_event); opal_event_del(&endpoint->ep_event);
} }
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock); OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
@ -177,7 +177,7 @@ static void orte_iof_base_endpoint_write_handler(int sd, short flags, void *user
/* is there anything left to write? */ /* is there anything left to write? */
if(opal_list_get_size(&endpoint->ep_frags) == 0) { if(opal_list_get_size(&endpoint->ep_frags) == 0) {
ompi_event_del(&endpoint->ep_event); opal_event_del(&endpoint->ep_event);
if(orte_iof_base.iof_waiting) { if(orte_iof_base.iof_waiting) {
opal_condition_signal(&orte_iof_base.iof_condition); opal_condition_signal(&orte_iof_base.iof_condition);
} }
@ -250,19 +250,19 @@ int orte_iof_base_endpoint_create(
/* setup event handler */ /* setup event handler */
switch(mode) { switch(mode) {
case ORTE_IOF_SOURCE: case ORTE_IOF_SOURCE:
ompi_event_set( opal_event_set(
&endpoint->ep_event, &endpoint->ep_event,
endpoint->ep_fd, endpoint->ep_fd,
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
orte_iof_base_endpoint_read_handler, orte_iof_base_endpoint_read_handler,
endpoint); endpoint);
ompi_event_add(&endpoint->ep_event, 0); opal_event_add(&endpoint->ep_event, 0);
break; break;
case ORTE_IOF_SINK: case ORTE_IOF_SINK:
ompi_event_set( opal_event_set(
&endpoint->ep_event, &endpoint->ep_event,
endpoint->ep_fd, endpoint->ep_fd,
OMPI_EV_WRITE|OMPI_EV_PERSIST, OPAL_EV_WRITE|OPAL_EV_PERSIST,
orte_iof_base_endpoint_write_handler, orte_iof_base_endpoint_write_handler,
endpoint); endpoint);
break; break;
@ -312,7 +312,7 @@ int orte_iof_base_endpoint_close(orte_iof_base_endpoint_t* endpoint)
endpoint->ep_state = ORTE_IOF_EP_CLOSING; endpoint->ep_state = ORTE_IOF_EP_CLOSING;
switch(endpoint->ep_mode) { switch(endpoint->ep_mode) {
case ORTE_IOF_SOURCE: case ORTE_IOF_SOURCE:
ompi_event_del(&endpoint->ep_event); opal_event_del(&endpoint->ep_event);
if(endpoint->ep_seq == endpoint->ep_ack) { if(endpoint->ep_seq == endpoint->ep_ack) {
endpoint->ep_state = ORTE_IOF_EP_CLOSED; endpoint->ep_state = ORTE_IOF_EP_CLOSED;
} }
@ -411,7 +411,7 @@ int orte_iof_base_endpoint_forward(
memcpy(frag->frag_ptr, data+rc, frag->frag_len); memcpy(frag->frag_ptr, data+rc, frag->frag_len);
opal_list_append(&endpoint->ep_frags, &frag->super); opal_list_append(&endpoint->ep_frags, &frag->super);
if(opal_list_get_size(&endpoint->ep_frags) == 1) { if(opal_list_get_size(&endpoint->ep_frags) == 1) {
ompi_event_add(&endpoint->ep_event,0); opal_event_add(&endpoint->ep_event,0);
} }
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock); OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
} else { } else {
@ -451,7 +451,7 @@ int orte_iof_base_endpoint_ack(
/* check to see if we need to reenable forwarding */ /* check to see if we need to reenable forwarding */
if(window_closed && window_open) { if(window_closed && window_open) {
ompi_event_add(&endpoint->ep_event, 0); opal_event_add(&endpoint->ep_event, 0);
} }
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock); OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
return ORTE_SUCCESS; return ORTE_SUCCESS;

Просмотреть файл

@ -3,7 +3,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/iof/iof.h" #include "mca/iof/iof.h"
#include "mca/iof/base/iof_base_header.h" #include "mca/iof/base/iof_base_header.h"
@ -26,7 +26,7 @@ struct orte_iof_base_endpoint_t {
int ep_state; int ep_state;
uint32_t ep_seq; uint32_t ep_seq;
uint32_t ep_ack; uint32_t ep_ack;
ompi_event_t ep_event; opal_event_t ep_event;
opal_list_t ep_frags; opal_list_t ep_frags;
}; };
typedef struct orte_iof_base_endpoint_t orte_iof_base_endpoint_t; typedef struct orte_iof_base_endpoint_t orte_iof_base_endpoint_t;

Просмотреть файл

@ -42,7 +42,7 @@ static void orte_iof_base_timer_cb(int fd, short flags, void *cbdata)
int orte_iof_base_flush(void) int orte_iof_base_flush(void)
{ {
opal_list_item_t* item; opal_list_item_t* item;
ompi_event_t ev; opal_event_t ev;
struct timeval tv = { 0, 0 }; struct timeval tv = { 0, 0 };
int flushed = 0; int flushed = 0;
size_t pending; size_t pending;
@ -54,14 +54,14 @@ int orte_iof_base_flush(void)
* wait on a timer callback to be called out of the event loop * wait on a timer callback to be called out of the event loop
*/ */
if(ompi_event_progress_thread() == false) { if(opal_event_progress_thread() == false) {
OPAL_THREAD_LOCK(&orte_iof_base.iof_lock); OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
ompi_evtimer_set(&ev, orte_iof_base_timer_cb, &flushed); opal_evtimer_set(&ev, orte_iof_base_timer_cb, &flushed);
ompi_event_add(&ev, &tv); opal_event_add(&ev, &tv);
while(flushed == 0) while(flushed == 0)
opal_condition_wait(&orte_iof_base.iof_condition, &orte_iof_base.iof_lock); opal_condition_wait(&orte_iof_base.iof_condition, &orte_iof_base.iof_lock);
} else { } else {
ompi_event_loop(OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_NONBLOCK);
OPAL_THREAD_LOCK(&orte_iof_base.iof_lock); OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
} }
orte_iof_base.iof_waiting++; orte_iof_base.iof_waiting++;
@ -79,11 +79,11 @@ int orte_iof_base_flush(void)
} }
} }
if(pending != 0) { if(pending != 0) {
if(ompi_event_progress_thread() == false) { if(opal_event_progress_thread() == false) {
opal_condition_wait(&orte_iof_base.iof_condition, &orte_iof_base.iof_lock); opal_condition_wait(&orte_iof_base.iof_condition, &orte_iof_base.iof_lock);
} else { } else {
OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock); OPAL_THREAD_UNLOCK(&orte_iof_base.iof_lock);
ompi_event_loop(OMPI_EVLOOP_ONCE); opal_event_loop(OPAL_EVLOOP_ONCE);
OPAL_THREAD_LOCK(&orte_iof_base.iof_lock); OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
} }
} }

Просмотреть файл

@ -4,7 +4,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "opal/class/opal_free_list.h" #include "opal/class/opal_free_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/iof/iof.h" #include "mca/iof/iof.h"
#include "mca/iof/base/base.h" #include "mca/iof/base/base.h"
#include "mca/iof/base/iof_base_header.h" #include "mca/iof/base/iof_base_header.h"

Просмотреть файл

@ -52,7 +52,7 @@
struct mca_oob_tcp_event_t { struct mca_oob_tcp_event_t {
opal_list_item_t item; opal_list_item_t item;
ompi_event_t event; opal_event_t event;
}; };
typedef struct mca_oob_tcp_event_t mca_oob_tcp_event_t; typedef struct mca_oob_tcp_event_t mca_oob_tcp_event_t;
@ -267,8 +267,8 @@ static void mca_oob_tcp_accept(void)
/* wait for receipt of peers process identifier to complete this connection */ /* wait for receipt of peers process identifier to complete this connection */
event = OBJ_NEW(mca_oob_tcp_event_t); event = OBJ_NEW(mca_oob_tcp_event_t);
ompi_event_set(&event->event, sd, OMPI_EV_READ, mca_oob_tcp_recv_handler, event); opal_event_set(&event->event, sd, OPAL_EV_READ, mca_oob_tcp_recv_handler, event);
ompi_event_add(&event->event, 0); opal_event_add(&event->event, 0);
} }
} }
@ -325,13 +325,13 @@ static int mca_oob_tcp_create_listen(void)
} }
/* register listen port */ /* register listen port */
ompi_event_set( opal_event_set(
&mca_oob_tcp_component.tcp_recv_event, &mca_oob_tcp_component.tcp_recv_event,
mca_oob_tcp_component.tcp_listen_sd, mca_oob_tcp_component.tcp_listen_sd,
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
mca_oob_tcp_recv_handler, mca_oob_tcp_recv_handler,
0); 0);
ompi_event_add(&mca_oob_tcp_component.tcp_recv_event, 0); opal_event_add(&mca_oob_tcp_component.tcp_recv_event, 0);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
@ -514,8 +514,8 @@ mca_oob_t* mca_oob_tcp_component_init(int* priority)
8); /* increment to grow by */ 8); /* increment to grow by */
/* intialize event library */ /* intialize event library */
memset(&mca_oob_tcp_component.tcp_recv_event, 0, sizeof(ompi_event_t)); memset(&mca_oob_tcp_component.tcp_recv_event, 0, sizeof(opal_event_t));
memset(&mca_oob_tcp_component.tcp_send_event, 0, sizeof(ompi_event_t)); memset(&mca_oob_tcp_component.tcp_send_event, 0, sizeof(opal_event_t));
/* create a listen socket */ /* create a listen socket */
if(mca_oob_tcp_create_listen() != OMPI_SUCCESS) { if(mca_oob_tcp_create_listen() != OMPI_SUCCESS) {
@ -989,11 +989,11 @@ int mca_oob_tcp_fini(void)
{ {
opal_list_item_t *item; opal_list_item_t *item;
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock); OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
ompi_event_disable(); /* disable event processing */ opal_event_disable(); /* disable event processing */
/* close listen socket */ /* close listen socket */
if (mca_oob_tcp_component.tcp_listen_sd >= 0) { if (mca_oob_tcp_component.tcp_listen_sd >= 0) {
ompi_event_del(&mca_oob_tcp_component.tcp_recv_event); opal_event_del(&mca_oob_tcp_component.tcp_recv_event);
close(mca_oob_tcp_component.tcp_listen_sd); close(mca_oob_tcp_component.tcp_listen_sd);
mca_oob_tcp_component.tcp_listen_sd = -1; mca_oob_tcp_component.tcp_listen_sd = -1;
} }
@ -1011,11 +1011,11 @@ int mca_oob_tcp_fini(void)
item != NULL; item != NULL;
item = opal_list_remove_first(&mca_oob_tcp_component.tcp_events)) { item = opal_list_remove_first(&mca_oob_tcp_component.tcp_events)) {
mca_oob_tcp_event_t* event = (mca_oob_tcp_event_t*)item; mca_oob_tcp_event_t* event = (mca_oob_tcp_event_t*)item;
ompi_event_del(&event->event); opal_event_del(&event->event);
OBJ_RELEASE(event); OBJ_RELEASE(event);
} }
ompi_event_enable(); opal_event_enable();
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock); OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }

Просмотреть файл

@ -27,7 +27,7 @@
#include "mca/ns/ns_types.h" #include "mca/ns/ns_types.h"
#include "opal/class/opal_free_list.h" #include "opal/class/opal_free_list.h"
#include "class/opal_hash_table.h" #include "class/opal_hash_table.h"
#include "event/event.h" #include "opal/event/event.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "opal/threads/condition.h" #include "opal/threads/condition.h"
#include "mca/oob/tcp/oob_tcp_peer.h" #include "mca/oob/tcp/oob_tcp_peer.h"
@ -255,8 +255,8 @@ struct mca_oob_tcp_component_t {
int tcp_peer_limit; /**< max size of tcp peer cache */ int tcp_peer_limit; /**< max size of tcp peer cache */
int tcp_peer_retries; /**< max number of retries before declaring peer gone */ int tcp_peer_retries; /**< max number of retries before declaring peer gone */
opal_free_list_t tcp_msgs; /**< free list of messages */ opal_free_list_t tcp_msgs; /**< free list of messages */
ompi_event_t tcp_send_event; /**< event structure for sends */ opal_event_t tcp_send_event; /**< event structure for sends */
ompi_event_t tcp_recv_event; /**< event structure for recvs */ opal_event_t tcp_recv_event; /**< event structure for recvs */
opal_mutex_t tcp_lock; /**< lock for accessing module state */ opal_mutex_t tcp_lock; /**< lock for accessing module state */
opal_list_t tcp_events; /**< list of pending events (accepts) */ opal_list_t tcp_events; /**< list of pending events (accepts) */
opal_list_t tcp_msg_post; /**< list of recieves user has posted */ opal_list_t tcp_msg_post; /**< list of recieves user has posted */

Просмотреть файл

@ -64,10 +64,10 @@ int mca_oob_tcp_msg_wait(mca_oob_tcp_msg_t* msg, int* rc)
#if OMPI_ENABLE_PROGRESS_THREADS #if OMPI_ENABLE_PROGRESS_THREADS
OPAL_THREAD_LOCK(&msg->msg_lock); OPAL_THREAD_LOCK(&msg->msg_lock);
while(msg->msg_complete == false) { while(msg->msg_complete == false) {
if(ompi_event_progress_thread()) { if(opal_event_progress_thread()) {
int rc; int rc;
OPAL_THREAD_UNLOCK(&msg->msg_lock); OPAL_THREAD_UNLOCK(&msg->msg_lock);
rc = ompi_event_loop(OMPI_EVLOOP_ONCE); rc = opal_event_loop(OPAL_EVLOOP_ONCE);
assert(rc >= 0); assert(rc >= 0);
OPAL_THREAD_LOCK(&msg->msg_lock); OPAL_THREAD_LOCK(&msg->msg_lock);
} else { } else {
@ -79,7 +79,7 @@ int mca_oob_tcp_msg_wait(mca_oob_tcp_msg_t* msg, int* rc)
#else #else
/* wait for message to complete */ /* wait for message to complete */
while(msg->msg_complete == false) while(msg->msg_complete == false)
ompi_event_loop(OMPI_EVLOOP_ONCE); opal_event_loop(OPAL_EVLOOP_ONCE);
#endif #endif
/* return status */ /* return status */
@ -108,10 +108,10 @@ int mca_oob_tcp_msg_timedwait(mca_oob_tcp_msg_t* msg, int* rc, struct timespec*
while(msg->msg_complete == false && while(msg->msg_complete == false &&
((uint32_t)tv.tv_sec <= secs || ((uint32_t)tv.tv_sec <= secs ||
((uint32_t)tv.tv_sec == secs && (uint32_t)tv.tv_usec < usecs))) { ((uint32_t)tv.tv_sec == secs && (uint32_t)tv.tv_usec < usecs))) {
if(ompi_event_progress_thread()) { if(opal_event_progress_thread()) {
int rc; int rc;
OPAL_THREAD_UNLOCK(&msg->msg_lock); OPAL_THREAD_UNLOCK(&msg->msg_lock);
rc = ompi_event_loop(OMPI_EVLOOP_ONCE); rc = opal_event_loop(OPAL_EVLOOP_ONCE);
assert(rc >= 0); assert(rc >= 0);
OPAL_THREAD_LOCK(&msg->msg_lock); OPAL_THREAD_LOCK(&msg->msg_lock);
} else { } else {
@ -125,7 +125,7 @@ int mca_oob_tcp_msg_timedwait(mca_oob_tcp_msg_t* msg, int* rc, struct timespec*
while(msg->msg_complete == false && while(msg->msg_complete == false &&
((uint32_t)tv.tv_sec <= secs || ((uint32_t)tv.tv_sec <= secs ||
((uint32_t)tv.tv_sec == secs && (uint32_t)tv.tv_usec < usecs))) { ((uint32_t)tv.tv_sec == secs && (uint32_t)tv.tv_usec < usecs))) {
ompi_event_loop(OMPI_EVLOOP_ONCE); opal_event_loop(OPAL_EVLOOP_ONCE);
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
} }
#endif #endif

Просмотреть файл

@ -88,7 +88,7 @@ static void mca_oob_tcp_peer_construct(mca_oob_tcp_peer_t* peer)
memset(&peer->peer_send_event, 0, sizeof(peer->peer_send_event)); memset(&peer->peer_send_event, 0, sizeof(peer->peer_send_event));
memset(&peer->peer_recv_event, 0, sizeof(peer->peer_recv_event)); memset(&peer->peer_recv_event, 0, sizeof(peer->peer_recv_event));
memset(&peer->peer_timer_event, 0, sizeof(peer->peer_timer_event)); memset(&peer->peer_timer_event, 0, sizeof(peer->peer_timer_event));
ompi_evtimer_set(&peer->peer_timer_event, mca_oob_tcp_peer_timer_handler, peer); opal_evtimer_set(&peer->peer_timer_event, mca_oob_tcp_peer_timer_handler, peer);
} }
/* /*
@ -113,16 +113,16 @@ static int mca_oob_tcp_peer_event_init(mca_oob_tcp_peer_t* peer)
{ {
memset(&peer->peer_recv_event, 0, sizeof(peer->peer_recv_event)); memset(&peer->peer_recv_event, 0, sizeof(peer->peer_recv_event));
memset(&peer->peer_send_event, 0, sizeof(peer->peer_send_event)); memset(&peer->peer_send_event, 0, sizeof(peer->peer_send_event));
ompi_event_set( opal_event_set(
&peer->peer_recv_event, &peer->peer_recv_event,
peer->peer_sd, peer->peer_sd,
OMPI_EV_READ|OMPI_EV_PERSIST, OPAL_EV_READ|OPAL_EV_PERSIST,
mca_oob_tcp_peer_recv_handler, mca_oob_tcp_peer_recv_handler,
peer); peer);
ompi_event_set( opal_event_set(
&peer->peer_send_event, &peer->peer_send_event,
peer->peer_sd, peer->peer_sd,
OMPI_EV_WRITE|OMPI_EV_PERSIST, OPAL_EV_WRITE|OPAL_EV_PERSIST,
mca_oob_tcp_peer_send_handler, mca_oob_tcp_peer_send_handler,
peer); peer);
return OMPI_SUCCESS; return OMPI_SUCCESS;
@ -165,7 +165,7 @@ int mca_oob_tcp_peer_send(mca_oob_tcp_peer_t* peer, mca_oob_tcp_msg_t* msg)
/*if the send does not complete */ /*if the send does not complete */
if(!mca_oob_tcp_msg_send_handler(msg, peer)) { if(!mca_oob_tcp_msg_send_handler(msg, peer)) {
peer->peer_send_msg = msg; peer->peer_send_msg = msg;
ompi_event_add(&peer->peer_send_event, 0); opal_event_add(&peer->peer_send_event, 0);
} else { } else {
mca_oob_tcp_msg_complete(msg, &peer->peer_name); mca_oob_tcp_msg_complete(msg, &peer->peer_name);
} }
@ -287,7 +287,7 @@ static int mca_oob_tcp_peer_start_connect(mca_oob_tcp_peer_t* peer)
ORTE_NAME_ARGS(&(peer->peer_name)), ORTE_NAME_ARGS(&(peer->peer_name)),
ompi_socket_errno); ompi_socket_errno);
mca_oob_tcp_peer_shutdown(peer); mca_oob_tcp_peer_shutdown(peer);
ompi_evtimer_add(&peer->peer_timer_event, &tv); opal_evtimer_add(&peer->peer_timer_event, &tv);
return OMPI_ERR_UNREACH; return OMPI_ERR_UNREACH;
} }
@ -332,7 +332,7 @@ static int mca_oob_tcp_peer_start_connect(mca_oob_tcp_peer_t* peer)
/* non-blocking so wait for completion */ /* non-blocking so wait for completion */
IMPORTANT_WINDOWS_COMMENT(); IMPORTANT_WINDOWS_COMMENT();
if(ompi_socket_errno == EINPROGRESS || ompi_socket_errno == EWOULDBLOCK) { if(ompi_socket_errno == EINPROGRESS || ompi_socket_errno == EWOULDBLOCK) {
ompi_event_add(&peer->peer_send_event, 0); opal_event_add(&peer->peer_send_event, 0);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
ompi_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_start_connect: connect to %s:%d failed with errno=%d", ompi_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_start_connect: connect to %s:%d failed with errno=%d",
@ -348,7 +348,7 @@ static int mca_oob_tcp_peer_start_connect(mca_oob_tcp_peer_t* peer)
/* send our globally unique process identifier to the peer */ /* send our globally unique process identifier to the peer */
if((rc = mca_oob_tcp_peer_send_connect_ack(peer)) == OMPI_SUCCESS) { if((rc = mca_oob_tcp_peer_send_connect_ack(peer)) == OMPI_SUCCESS) {
peer->peer_state = MCA_OOB_TCP_CONNECT_ACK; peer->peer_state = MCA_OOB_TCP_CONNECT_ACK;
ompi_event_add(&peer->peer_recv_event, 0); opal_event_add(&peer->peer_recv_event, 0);
} else { } else {
ompi_output(0, ompi_output(0,
"[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_start_connect: " "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_start_connect: "
@ -375,7 +375,7 @@ static void mca_oob_tcp_peer_complete_connect(mca_oob_tcp_peer_t* peer)
ompi_socklen_t so_length = sizeof(so_error); ompi_socklen_t so_length = sizeof(so_error);
/* unregister from receiving event notifications */ /* unregister from receiving event notifications */
ompi_event_del(&peer->peer_send_event); opal_event_del(&peer->peer_send_event);
/* check connect completion status */ /* check connect completion status */
if(getsockopt(peer->peer_sd, SOL_SOCKET, SO_ERROR, (char *)&so_error, &so_length) < 0) { if(getsockopt(peer->peer_sd, SOL_SOCKET, SO_ERROR, (char *)&so_error, &so_length) < 0) {
@ -387,7 +387,7 @@ static void mca_oob_tcp_peer_complete_connect(mca_oob_tcp_peer_t* peer)
return; return;
} }
if(so_error == EINPROGRESS) { if(so_error == EINPROGRESS) {
ompi_event_add(&peer->peer_send_event, 0); opal_event_add(&peer->peer_send_event, 0);
return; return;
} else if (so_error == ECONNREFUSED || so_error == ETIMEDOUT) { } else if (so_error == ECONNREFUSED || so_error == ETIMEDOUT) {
struct timeval tv = { 1,0 }; struct timeval tv = { 1,0 };
@ -397,7 +397,7 @@ static void mca_oob_tcp_peer_complete_connect(mca_oob_tcp_peer_t* peer)
ORTE_NAME_ARGS(&(peer->peer_name)), ORTE_NAME_ARGS(&(peer->peer_name)),
so_error, getpid()); so_error, getpid());
mca_oob_tcp_peer_shutdown(peer); mca_oob_tcp_peer_shutdown(peer);
ompi_evtimer_add(&peer->peer_timer_event, &tv); opal_evtimer_add(&peer->peer_timer_event, &tv);
return; return;
} else if(so_error != 0) { } else if(so_error != 0) {
ompi_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_complete_connect: connect() failed with errno=%d\n", ompi_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_complete_connect: connect() failed with errno=%d\n",
@ -410,7 +410,7 @@ static void mca_oob_tcp_peer_complete_connect(mca_oob_tcp_peer_t* peer)
if(mca_oob_tcp_peer_send_connect_ack(peer) == OMPI_SUCCESS) { if(mca_oob_tcp_peer_send_connect_ack(peer) == OMPI_SUCCESS) {
peer->peer_state = MCA_OOB_TCP_CONNECT_ACK; peer->peer_state = MCA_OOB_TCP_CONNECT_ACK;
ompi_event_add(&peer->peer_recv_event, 0); opal_event_add(&peer->peer_recv_event, 0);
} else { } else {
ompi_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_complete_connect: unable to send connect ack.", ompi_output(0, "[%lu,%lu,%lu]-[%lu,%lu,%lu] mca_oob_tcp_peer_complete_connect: unable to send connect ack.",
ORTE_NAME_ARGS(orte_process_info.my_name), ORTE_NAME_ARGS(orte_process_info.my_name),
@ -425,14 +425,14 @@ static void mca_oob_tcp_peer_complete_connect(mca_oob_tcp_peer_t* peer)
*/ */
static void mca_oob_tcp_peer_connected(mca_oob_tcp_peer_t* peer) static void mca_oob_tcp_peer_connected(mca_oob_tcp_peer_t* peer)
{ {
ompi_event_del(&peer->peer_timer_event); opal_event_del(&peer->peer_timer_event);
peer->peer_state = MCA_OOB_TCP_CONNECTED; peer->peer_state = MCA_OOB_TCP_CONNECTED;
peer->peer_retries = 0; peer->peer_retries = 0;
if(opal_list_get_size(&peer->peer_send_queue) > 0) { if(opal_list_get_size(&peer->peer_send_queue) > 0) {
if(NULL == peer->peer_send_msg) if(NULL == peer->peer_send_msg)
peer->peer_send_msg = (mca_oob_tcp_msg_t*) peer->peer_send_msg = (mca_oob_tcp_msg_t*)
opal_list_remove_first(&peer->peer_send_queue); opal_list_remove_first(&peer->peer_send_queue);
ompi_event_add(&peer->peer_send_event, 0); opal_event_add(&peer->peer_send_event, 0);
} }
} }
@ -474,13 +474,13 @@ void mca_oob_tcp_peer_shutdown(mca_oob_tcp_peer_t* peer)
} }
if (peer->peer_sd >= 0) { if (peer->peer_sd >= 0) {
ompi_event_del(&peer->peer_recv_event); opal_event_del(&peer->peer_recv_event);
ompi_event_del(&peer->peer_send_event); opal_event_del(&peer->peer_send_event);
close(peer->peer_sd); close(peer->peer_sd);
peer->peer_sd = -1; peer->peer_sd = -1;
} }
ompi_event_del(&peer->peer_timer_event); opal_event_del(&peer->peer_timer_event);
peer->peer_state = MCA_OOB_TCP_CLOSED; peer->peer_state = MCA_OOB_TCP_CLOSED;
} }
@ -751,7 +751,7 @@ static void mca_oob_tcp_peer_send_handler(int sd, short flags, void* user)
/* if nothing else to do unregister for send event notifications */ /* if nothing else to do unregister for send event notifications */
if(NULL == peer->peer_send_msg) { if(NULL == peer->peer_send_msg) {
ompi_event_del(&peer->peer_send_event); opal_event_del(&peer->peer_send_event);
} }
break; break;
} }
@ -760,7 +760,7 @@ static void mca_oob_tcp_peer_send_handler(int sd, short flags, void* user)
ORTE_NAME_ARGS(orte_process_info.my_name), ORTE_NAME_ARGS(orte_process_info.my_name),
ORTE_NAME_ARGS(&(peer->peer_name)), ORTE_NAME_ARGS(&(peer->peer_name)),
peer->peer_state); peer->peer_state);
ompi_event_del(&peer->peer_send_event); opal_event_del(&peer->peer_send_event);
break; break;
} }
OPAL_THREAD_UNLOCK(&peer->peer_lock); OPAL_THREAD_UNLOCK(&peer->peer_lock);
@ -853,7 +853,7 @@ bool mca_oob_tcp_peer_accept(mca_oob_tcp_peer_t* peer, int sd)
} }
mca_oob_tcp_peer_connected(peer); mca_oob_tcp_peer_connected(peer);
ompi_event_add(&peer->peer_recv_event, 0); opal_event_add(&peer->peer_recv_event, 0);
if(mca_oob_tcp_component.tcp_debug > 0) { if(mca_oob_tcp_component.tcp_debug > 0) {
mca_oob_tcp_peer_dump(peer, "accepted"); mca_oob_tcp_peer_dump(peer, "accepted");
} }

Просмотреть файл

@ -56,9 +56,9 @@ struct mca_oob_tcp_peer_t {
int peer_retries; /**< number of times connection attempt has failed */ int peer_retries; /**< number of times connection attempt has failed */
mca_oob_tcp_addr_t* peer_addr; /**< the addresses of the peer process */ mca_oob_tcp_addr_t* peer_addr; /**< the addresses of the peer process */
int peer_sd; /**< socket descriptor of the connection */ int peer_sd; /**< socket descriptor of the connection */
ompi_event_t peer_send_event; /**< registration with event thread for send events */ opal_event_t peer_send_event; /**< registration with event thread for send events */
ompi_event_t peer_recv_event; /**< registration with event thread for recv events */ opal_event_t peer_recv_event; /**< registration with event thread for recv events */
ompi_event_t peer_timer_event; /**< timer for retrying connection failures */ opal_event_t peer_timer_event; /**< timer for retrying connection failures */
opal_mutex_t peer_lock; /**< protect critical data structures */ opal_mutex_t peer_lock; /**< protect critical data structures */
opal_list_t peer_send_queue; /**< list of messages to send */ opal_list_t peer_send_queue; /**< list of messages to send */
mca_oob_tcp_msg_t *peer_send_msg; /**< current send in progress */ mca_oob_tcp_msg_t *peer_send_msg; /**< current send in progress */

Просмотреть файл

@ -29,7 +29,7 @@
#include "util/output.h" #include "util/output.h"
#include "util/ompi_environ.h" #include "util/ompi_environ.h"
#include "util/proc_info.h" #include "util/proc_info.h"
#include "event/event.h" #include "opal/event/event.h"
#include "runtime/orte_wait.h" #include "runtime/orte_wait.h"
#include "runtime/runtime.h" #include "runtime/runtime.h"
#include "mca/ns/base/base.h" #include "mca/ns/base/base.h"

Просмотреть файл

@ -28,7 +28,7 @@
#include "util/output.h" #include "util/output.h"
#include "util/ompi_environ.h" #include "util/ompi_environ.h"
#include "util/proc_info.h" #include "util/proc_info.h"
#include "event/event.h" #include "opal/event/event.h"
#include "runtime/orte_wait.h" #include "runtime/orte_wait.h"
#include "runtime/runtime.h" #include "runtime/runtime.h"
#include "mca/ns/base/base.h" #include "mca/ns/base/base.h"
@ -843,14 +843,14 @@ complete:
int orte_pls_bproc_seed_launch_threaded(orte_jobid_t jobid) int orte_pls_bproc_seed_launch_threaded(orte_jobid_t jobid)
{ {
struct timeval tv = { 0, 0 }; struct timeval tv = { 0, 0 };
struct ompi_event event; struct opal_event event;
struct orte_pls_bproc_stack_t stack; struct orte_pls_bproc_stack_t stack;
OBJ_CONSTRUCT(&stack, orte_pls_bproc_stack_t); OBJ_CONSTRUCT(&stack, orte_pls_bproc_stack_t);
stack.jobid = jobid; stack.jobid = jobid;
ompi_evtimer_set(&event, orte_pls_bproc_seed_launch_cb, &stack); opal_evtimer_set(&event, orte_pls_bproc_seed_launch_cb, &stack);
ompi_evtimer_add(&event, &tv); opal_evtimer_add(&event, &tv);
OPAL_THREAD_LOCK(&stack.mutex); OPAL_THREAD_LOCK(&stack.mutex);
while(stack.complete == false) while(stack.complete == false)

Просмотреть файл

@ -34,7 +34,7 @@
#include <signal.h> #include <signal.h>
#include "include/orte_constants.h" #include "include/orte_constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/output.h" #include "util/output.h"
#include "util/sys_info.h" #include "util/sys_info.h"
@ -528,14 +528,14 @@ static int orte_pls_fork_launch_threaded(orte_jobid_t jobid)
{ {
struct timeval tv = { 0, 0 }; struct timeval tv = { 0, 0 };
struct ompi_event event; struct opal_event event;
struct orte_pls_fork_stack_t stack; struct orte_pls_fork_stack_t stack;
OBJ_CONSTRUCT(&stack, orte_pls_fork_stack_t); OBJ_CONSTRUCT(&stack, orte_pls_fork_stack_t);
stack.jobid = jobid; stack.jobid = jobid;
ompi_evtimer_set(&event, orte_pls_fork_launch_cb, &stack); opal_evtimer_set(&event, orte_pls_fork_launch_cb, &stack);
ompi_evtimer_add(&event, &tv); opal_evtimer_add(&event, &tv);
OPAL_THREAD_LOCK(&stack.mutex); OPAL_THREAD_LOCK(&stack.mutex);
while(false == stack.complete) { while(false == stack.complete) {

Просмотреть файл

@ -43,7 +43,7 @@
#include "util/session_dir.h" #include "util/session_dir.h"
#include "util/if.h" #include "util/if.h"
#include "util/path.h" #include "util/path.h"
#include "event/event.h" #include "opal/event/event.h"
#include "runtime/orte_wait.h" #include "runtime/orte_wait.h"
#include "mca/base/mca_base_param.h" #include "mca/base/mca_base_param.h"
@ -784,14 +784,14 @@ static void orte_pls_rsh_launch_cb(int fd, short event, void* args)
static int orte_pls_rsh_launch_threaded(orte_jobid_t jobid) static int orte_pls_rsh_launch_threaded(orte_jobid_t jobid)
{ {
struct timeval tv = { 0, 0 }; struct timeval tv = { 0, 0 };
struct ompi_event event; struct opal_event event;
struct orte_pls_rsh_stack_t stack; struct orte_pls_rsh_stack_t stack;
OBJ_CONSTRUCT(&stack, orte_pls_rsh_stack_t); OBJ_CONSTRUCT(&stack, orte_pls_rsh_stack_t);
stack.jobid = jobid; stack.jobid = jobid;
ompi_evtimer_set(&event, orte_pls_rsh_launch_cb, &stack); opal_evtimer_set(&event, orte_pls_rsh_launch_cb, &stack);
ompi_evtimer_add(&event, &tv); opal_evtimer_add(&event, &tv);
OPAL_THREAD_LOCK(&stack.mutex); OPAL_THREAD_LOCK(&stack.mutex);
while(stack.complete == false) while(stack.complete == false)

Просмотреть файл

@ -34,7 +34,7 @@
#import "util/argv.h" #import "util/argv.h"
#import "util/output.h" #import "util/output.h"
#import "util/session_dir.h" #import "util/session_dir.h"
#import "event/event.h" #import "opal/event/event.h"
#import "runtime/orte_wait.h" #import "runtime/orte_wait.h"
#import "mca/ns/ns.h" #import "mca/ns/ns.h"
#import "mca/pls/pls.h" #import "mca/pls/pls.h"

Просмотреть файл

@ -24,7 +24,7 @@
#endif #endif
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/output.h" #include "util/output.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "dps/dps.h" #include "dps/dps.h"
@ -116,7 +116,7 @@ int orte_init_stage1(void)
/* /*
* Initialize the event library * Initialize the event library
*/ */
if (OMPI_SUCCESS != (ret = ompi_event_init())) { if (OMPI_SUCCESS != (ret = opal_event_init())) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
return ret; return ret;
} }

Просмотреть файл

@ -23,7 +23,7 @@
#include "util/sys_info.h" #include "util/sys_info.h"
#include "runtime/runtime.h" #include "runtime/runtime.h"
#include "util/output.h" #include "util/output.h"
#include "event/event.h" #include "opal/event/event.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "opal/threads/condition.h" #include "opal/threads/condition.h"
#include "mca/ns/ns_types.h" #include "mca/ns/ns_types.h"

Просмотреть файл

@ -24,9 +24,9 @@
#endif #endif
#include "include/constants.h" #include "include/constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/output.h" #include "util/output.h"
#include "event/event.h" #include "opal/event/event.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "mca/mca.h" #include "mca/mca.h"
#include "mca/base/base.h" #include "mca/base/base.h"
@ -70,7 +70,7 @@ int orte_restart(orte_process_name_t *name, const char* uri)
* Restart event library * Restart event library
*/ */
if (ORTE_SUCCESS != (rc = ompi_event_restart())) { if (ORTE_SUCCESS != (rc = opal_event_restart())) {
ORTE_ERROR_LOG(rc); ORTE_ERROR_LOG(rc);
return rc; return rc;
} }

Просмотреть файл

@ -39,7 +39,7 @@
#include "include/orte_constants.h" #include "include/orte_constants.h"
#include "dps/dps.h" #include "dps/dps.h"
#include "event/event.h" #include "opal/event/event.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "opal/threads/condition.h" #include "opal/threads/condition.h"
#include "runtime/orte_wait.h" #include "runtime/orte_wait.h"

Просмотреть файл

@ -21,7 +21,7 @@
#include "include/orte_constants.h" #include "include/orte_constants.h"
#include "runtime/runtime.h" #include "runtime/runtime.h"
#include "runtime/orte_wait.h" #include "runtime/orte_wait.h"
#include "event/event.h" #include "opal/event/event.h"
#include "mca/rml/base/base.h" #include "mca/rml/base/base.h"
#include "dps/dps.h" #include "dps/dps.h"
#include "mca/ns/base/base.h" #include "mca/ns/base/base.h"
@ -67,7 +67,7 @@ int orte_system_finalize(void)
opal_progress_finalize(); opal_progress_finalize();
ompi_event_fini(); opal_event_fini();
#ifndef WIN32 #ifndef WIN32
orte_session_dir_finalize(orte_process_info.my_name); orte_session_dir_finalize(orte_process_info.my_name);

Просмотреть файл

@ -33,7 +33,7 @@
#include "util/output.h" #include "util/output.h"
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
#include "event/event.h" #include "opal/event/event.h"
#include "include/constants.h" #include "include/constants.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "opal/threads/condition.h" #include "opal/threads/condition.h"
@ -124,7 +124,7 @@ static volatile int cb_enabled = true;
static opal_mutex_t mutex; static opal_mutex_t mutex;
static opal_list_t pending_pids; static opal_list_t pending_pids;
static opal_list_t registered_cb; static opal_list_t registered_cb;
static struct ompi_event handler; static struct opal_event handler;
/********************************************************************* /*********************************************************************
@ -159,11 +159,11 @@ orte_wait_init(void)
OBJ_CONSTRUCT(&pending_pids, opal_list_t); OBJ_CONSTRUCT(&pending_pids, opal_list_t);
OBJ_CONSTRUCT(&registered_cb, opal_list_t); OBJ_CONSTRUCT(&registered_cb, opal_list_t);
ompi_event_set(&handler, SIGCHLD, OMPI_EV_SIGNAL|OMPI_EV_PERSIST, opal_event_set(&handler, SIGCHLD, OPAL_EV_SIGNAL|OPAL_EV_PERSIST,
orte_wait_signal_callback, orte_wait_signal_callback,
&handler); &handler);
ompi_event_add(&handler, NULL); opal_event_add(&handler, NULL);
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }
@ -174,7 +174,7 @@ orte_wait_finalize(void)
opal_list_item_t *item; opal_list_item_t *item;
OPAL_THREAD_LOCK(&mutex); OPAL_THREAD_LOCK(&mutex);
ompi_event_del(&handler); opal_event_del(&handler);
/* clear out the lists */ /* clear out the lists */
while (NULL != (item = opal_list_remove_first(&pending_pids))) { while (NULL != (item = opal_list_remove_first(&pending_pids))) {
@ -272,7 +272,7 @@ orte_waitpid(pid_t wpid, int *status, int options)
#if OMPI_HAVE_POSIX_THREADS && OMPI_ENABLE_PROGRESS_THREADS #if OMPI_HAVE_POSIX_THREADS && OMPI_ENABLE_PROGRESS_THREADS
if (opal_using_threads()) { if (opal_using_threads()) {
opal_mutex_unlock(&mutex); opal_mutex_unlock(&mutex);
ompi_event_loop(OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_NONBLOCK);
opal_mutex_lock(&mutex); opal_mutex_lock(&mutex);
} }
#endif #endif
@ -296,8 +296,8 @@ orte_waitpid(pid_t wpid, int *status, int options)
from under it. Yes, it's spinning. No, we won't spin from under it. Yes, it's spinning. No, we won't spin
for long. */ for long. */
if (!OMPI_HAVE_THREAD_SUPPORT || ompi_event_progress_thread()) { if (!OMPI_HAVE_THREAD_SUPPORT || opal_event_progress_thread()) {
ompi_event_loop(OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_NONBLOCK);
} }
} }
@ -355,9 +355,9 @@ orte_wait_cb_cancel(pid_t wpid)
void void
orte_wait_signal_callback(int fd, short event, void *arg) orte_wait_signal_callback(int fd, short event, void *arg)
{ {
struct ompi_event *signal = (struct ompi_event*) arg; struct opal_event *signal = (struct opal_event*) arg;
if (SIGCHLD != OMPI_EVENT_SIGNAL(signal)) return; if (SIGCHLD != OPAL_EVENT_SIGNAL(signal)) return;
OPAL_THREAD_LOCK(&mutex); OPAL_THREAD_LOCK(&mutex);
do_waitall(0); do_waitall(0);
@ -559,9 +559,9 @@ internal_waitpid(pid_t pid, int *status, int options)
#if OMPI_THREADS_HAVE_DIFFERENT_PIDS #if OMPI_THREADS_HAVE_DIFFERENT_PIDS
waitpid_callback_data_t data; waitpid_callback_data_t data;
struct timeval tv; struct timeval tv;
struct ompi_event ev; struct opal_event ev;
if (ompi_event_progress_thread()) { if (opal_event_progress_thread()) {
/* I already am the progress thread. no need to event me */ /* I already am the progress thread. no need to event me */
return waitpid(pid, status, options); return waitpid(pid, status, options);
} }
@ -577,8 +577,8 @@ internal_waitpid(pid_t pid, int *status, int options)
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = 0; tv.tv_usec = 0;
ompi_evtimer_set(&ev, internal_waitpid_callback, &data); opal_evtimer_set(&ev, internal_waitpid_callback, &data);
ompi_evtimer_add(&ev, &tv); opal_evtimer_add(&ev, &tv);
while (data.done == false) { while (data.done == false) {
opal_condition_wait(&(data.cond), &(data.mutex)); opal_condition_wait(&(data.cond), &(data.mutex));

Просмотреть файл

@ -37,7 +37,7 @@
#endif #endif
#include <errno.h> #include <errno.h>
#include "event/event.h" #include "opal/event/event.h"
#include "include/constants.h" #include "include/constants.h"
#include "util/argv.h" #include "util/argv.h"

Просмотреть файл

@ -36,7 +36,7 @@
#include "opal/threads/condition.h" #include "opal/threads/condition.h"
#include "dps/dps.h" #include "dps/dps.h"
#include "event/event.h" #include "opal/event/event.h"
#include "util/argv.h" #include "util/argv.h"
#include "util/path.h" #include "util/path.h"
#include "util/output.h" #include "util/output.h"
@ -235,7 +235,7 @@ int main(int argc, char *argv[])
/* /*
* Initialize the event library * Initialize the event library
*/ */
if (OMPI_SUCCESS != (ret = ompi_event_init())) { if (OMPI_SUCCESS != (ret = opal_event_init())) {
ORTE_ERROR_LOG(ret); ORTE_ERROR_LOG(ret);
return ret; return ret;
} }

Просмотреть файл

@ -32,7 +32,7 @@
#include "include/orte_constants.h" #include "include/orte_constants.h"
#include "event/event.h" #include "opal/event/event.h"
#include "class/orte_pointer_array.h" #include "class/orte_pointer_array.h"
#include "util/proc_info.h" #include "util/proc_info.h"
#include "util/argv.h" #include "util/argv.h"
@ -65,8 +65,8 @@ extern char** environ;
/* /*
* Globals * Globals
*/ */
static struct ompi_event term_handler; static struct opal_event term_handler;
static struct ompi_event int_handler; static struct opal_event int_handler;
static orte_jobid_t jobid = ORTE_JOBID_MAX; static orte_jobid_t jobid = ORTE_JOBID_MAX;
static orte_pointer_array_t *apps_pa; static orte_pointer_array_t *apps_pa;
static bool wait_for_job_completion = true; static bool wait_for_job_completion = true;
@ -334,12 +334,12 @@ int main(int argc, char *argv[])
/* Prep to start the application */ /* Prep to start the application */
ompi_event_set(&term_handler, SIGTERM, OMPI_EV_SIGNAL, opal_event_set(&term_handler, SIGTERM, OPAL_EV_SIGNAL,
signal_callback, NULL); signal_callback, NULL);
ompi_event_add(&term_handler, NULL); opal_event_add(&term_handler, NULL);
ompi_event_set(&int_handler, SIGINT, OMPI_EV_SIGNAL, opal_event_set(&int_handler, SIGINT, OPAL_EV_SIGNAL,
signal_callback, NULL); signal_callback, NULL);
ompi_event_add(&int_handler, NULL); opal_event_add(&int_handler, NULL);
/* Spawn the job */ /* Spawn the job */
@ -562,7 +562,7 @@ static void signal_callback(int fd, short flags, void *arg)
{ {
int ret; int ret;
struct timeval tv = { 5, 0 }; struct timeval tv = { 5, 0 };
ompi_event_t* event; opal_event_t* event;
static int signalled = 0; static int signalled = 0;
if (0 != signalled++) { if (0 != signalled++) {
@ -577,9 +577,9 @@ static void signal_callback(int fd, short flags, void *arg)
} }
} }
if (NULL != (event = (ompi_event_t*)malloc(sizeof(ompi_event_t)))) { if (NULL != (event = (opal_event_t*)malloc(sizeof(opal_event_t)))) {
ompi_evtimer_set(event, exit_callback, NULL); opal_evtimer_set(event, exit_callback, NULL);
ompi_evtimer_add(event, &tv); opal_evtimer_add(event, &tv);
} }
} }

Просмотреть файл

@ -28,7 +28,7 @@
#include "util/sys_info.h" #include "util/sys_info.h"
#include "util/proc_info.h" #include "util/proc_info.h"
#include "util/output.h" #include "util/output.h"
#include "event/event.h" #include "opal/event/event.h"
#include "runtime/runtime.h" #include "runtime/runtime.h"
#include "mca/mca.h" #include "mca/mca.h"
#include "mca/base/base.h" #include "mca/base/base.h"
@ -84,8 +84,8 @@ int main(int argc, char **argv)
} }
/* initialize event library */ /* initialize event library */
if (OMPI_SUCCESS != ompi_event_init()) { if (OMPI_SUCCESS != opal_event_init()) {
fprintf(test_out, "ompi_event_init failed - please report error to bugs@open-mpi.org\n"); fprintf(test_out, "opal_event_init failed - please report error to bugs@open-mpi.org\n");
exit (1); exit (1);
} }
@ -115,11 +115,11 @@ int main(int argc, char **argv)
int status; int status;
if(waitpid(pid, &status, WNOHANG) != 0) if(waitpid(pid, &status, WNOHANG) != 0)
break; break;
ompi_event_loop(OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_NONBLOCK);
} }
#else #else
fprintf(stderr, "setenv OMPI_MCA_oob_base_seed %s\n", mca_oob_get_contact_info()); fprintf(stderr, "setenv OMPI_MCA_oob_base_seed %s\n", mca_oob_get_contact_info());
ompi_event_loop(0); opal_event_loop(0);
#endif #endif
return(0); return(0);
} else { } else {

Просмотреть файл

@ -24,7 +24,7 @@
#include "util/sys_info.h" #include "util/sys_info.h"
#include "util/proc_info.h" #include "util/proc_info.h"
#include "util/output.h" #include "util/output.h"
#include "event/event.h" #include "opal/event/event.h"
#include "runtime/runtime.h" #include "runtime/runtime.h"
#include "mca/mca.h" #include "mca/mca.h"
#include "mca/base/base.h" #include "mca/base/base.h"
@ -79,8 +79,8 @@ int main(int argc, char **argv)
} }
/* initialize event library */ /* initialize event library */
if (OMPI_SUCCESS != ompi_event_init()) { if (OMPI_SUCCESS != opal_event_init()) {
fprintf(test_out, "ompi_event_init failed - please report error to bugs@open-mpi.org\n"); fprintf(test_out, "opal_event_init failed - please report error to bugs@open-mpi.org\n");
exit (1); exit (1);
} }
@ -110,11 +110,11 @@ int main(int argc, char **argv)
int status; int status;
if(waitpid(pid, &status, WNOHANG) != 0) if(waitpid(pid, &status, WNOHANG) != 0)
break; break;
ompi_event_loop(OMPI_EVLOOP_NONBLOCK); opal_event_loop(OPAL_EVLOOP_NONBLOCK);
} }
#else #else
fprintf(stderr, "OMPI_MCA_oob_base_seed=%s", mca_oob_get_contact_info()); fprintf(stderr, "OMPI_MCA_oob_base_seed=%s", mca_oob_get_contact_info());
ompi_event_loop(0); opal_event_loop(0);
#endif #endif
} else { } else {
run_test(); run_test();

Просмотреть файл

@ -23,7 +23,7 @@ int main(int argc, char **argv) {
WSAStartup (MAKE_WORD(2,2), &winsockdata); WSAStartup (MAKE_WORD(2,2), &winsockdata);
ompi_init(); ompi_init();
ompi_event_init(); opal_event_init();
WSACleanup(); WSACleanup();