* rename ompi_event to opal_event
This commit was SVN r6328.
This commit is contained in:
parent
39dbeeedfb
commit
23b687b0f4
@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.h"
|
||||
#include "mca/pml/pml.h"
|
||||
@ -33,7 +33,7 @@ int mca_btl_base_close(void)
|
||||
mca_btl_base_selected_module_t *sm;
|
||||
|
||||
/* disable event processing while cleaning up btls */
|
||||
ompi_event_disable();
|
||||
opal_event_disable();
|
||||
|
||||
/* 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);
|
||||
|
||||
/* restore event processing */
|
||||
ompi_event_enable();
|
||||
opal_event_enable();
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
|
@ -28,7 +28,7 @@
|
||||
/* Open MPI includes */
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "mca/btl/base/base.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "ompi_config.h"
|
||||
#include "gm_config.h"
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define MCA_BTL_GM_ENDPOINT_H
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "btl_gm_frag.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
/* Open MPI includes */
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "util/output.h"
|
||||
@ -68,10 +68,10 @@ struct mca_btl_mvapi_component_t {
|
||||
opal_list_t ib_procs;
|
||||
/**< list of ib proc structures */
|
||||
|
||||
ompi_event_t ib_send_event;
|
||||
opal_event_t ib_send_event;
|
||||
/**< event structure for sends */
|
||||
|
||||
ompi_event_t ib_recv_event;
|
||||
opal_event_t ib_recv_event;
|
||||
/**< event structure for recvs */
|
||||
|
||||
opal_mutex_t ib_lock;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define MCA_BTL_IB_ENDPOINT_H
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "btl_mvapi_frag.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
/* Open MPI includes */
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "util/output.h"
|
||||
@ -68,10 +68,10 @@ struct mca_btl_openib_component_t {
|
||||
opal_list_t ib_procs;
|
||||
/**< list of ib proc structures */
|
||||
|
||||
ompi_event_t ib_send_event;
|
||||
opal_event_t ib_send_event;
|
||||
/**< event structure for sends */
|
||||
|
||||
ompi_event_t ib_recv_event;
|
||||
opal_event_t ib_recv_event;
|
||||
/**< event structure for recvs */
|
||||
|
||||
opal_mutex_t ib_lock;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define MCA_BTL_IB_ENDPOINT_H
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "btl_openib_frag.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "class/ompi_fifo.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "mca/btl/base/base.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "include/sys/cache.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define MCA_BTL_SELF_ENDPOINT_H
|
||||
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS == 1
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "class/ompi_fifo.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "mca/btl/base/base.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "include/sys/cache.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define MCA_BTL_SM_ENDPOINT_H
|
||||
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS == 1
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@
|
||||
/* Open MPI includes */
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "mca/btl/base/base.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define MCA_BTL_TEMPLATE_ENDPOINT_H
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
#include "btl_template_frag.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <gm.h>
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/mpool/mpool.h"
|
||||
#include "mca/allocator/allocator.h"
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/mpool/mpool.h"
|
||||
#include "mca/allocator/allocator.h"
|
||||
#include "mca/common/vapi/vapi_mem_reg.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/mpool/mpool.h"
|
||||
#include "mca/allocator/allocator.h"
|
||||
#include "mca/common/vapi/vapi_mem_reg.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/mpool/mpool.h"
|
||||
#include "mca/allocator/allocator.h"
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "pml_example.h"
|
||||
#include "mca/base/mca_base_param.h"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "include/sys/cache.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mpi.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/btl/btl.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mpi.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mpi.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.h"
|
||||
#include "mca/pml/pml.h"
|
||||
@ -33,7 +33,7 @@ int mca_ptl_base_close(void)
|
||||
mca_ptl_base_selected_module_t *sm;
|
||||
|
||||
/* disable event processing while cleaning up ptls */
|
||||
ompi_event_disable();
|
||||
opal_event_disable();
|
||||
|
||||
/* 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);
|
||||
|
||||
/* restore event processing */
|
||||
ompi_event_enable();
|
||||
opal_event_enable();
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
#include "ptl_elan_frag.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef 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/ptl/ptl.h"
|
||||
#include "mca/pml/base/pml_base_recvreq.h"
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
#include "datatype/datatype.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define PTL_SELF_H_HAS_BEEN_INCLUDED
|
||||
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
#include "mca/ptl/base/ptl_base_sendreq.h"
|
||||
|
@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "class/ompi_bitmap.h"
|
||||
#include "class/ompi_fifo.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
#include "mca/mpool/mpool.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "include/sys/cache.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define MCA_PTL_SM_PEER_H
|
||||
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS == 1
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include "class/ompi_free_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.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_events; /**< list of pending events */
|
||||
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 */
|
||||
ompi_event_t tcp_recv_event; /**< event structure for recvs */
|
||||
opal_event_t tcp_send_event; /**< event structure for sends */
|
||||
opal_event_t tcp_recv_event; /**< event structure for recvs */
|
||||
opal_mutex_t tcp_lock; /**< lock for accessing module state */
|
||||
};
|
||||
typedef struct mca_ptl_tcp_component_t mca_ptl_tcp_component_t;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#endif
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/if.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.h"
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
struct mca_ptl_tcp_event_t {
|
||||
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;
|
||||
|
||||
@ -252,7 +252,7 @@ int mca_ptl_tcp_component_close(void)
|
||||
free(mca_ptl_tcp_component.tcp_ptl_modules);
|
||||
|
||||
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);
|
||||
mca_ptl_tcp_component.tcp_listen_sd = -1;
|
||||
}
|
||||
@ -263,7 +263,7 @@ int mca_ptl_tcp_component_close(void)
|
||||
item != NULL;
|
||||
item = opal_list_remove_first(&mca_ptl_tcp_component.tcp_events)) {
|
||||
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);
|
||||
}
|
||||
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 */
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&mca_ptl_tcp_component.tcp_recv_event,
|
||||
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,
|
||||
0);
|
||||
return OMPI_SUCCESS;
|
||||
@ -537,12 +537,12 @@ int mca_ptl_tcp_component_control(int param, void* value, size_t size)
|
||||
switch(param) {
|
||||
case MCA_PTL_ENABLE:
|
||||
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) {
|
||||
opal_progress_events(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_progress_events(OPAL_EVLOOP_NONBLOCK);
|
||||
}
|
||||
} else {
|
||||
ompi_event_del(&mca_ptl_tcp_component.tcp_recv_event);
|
||||
opal_event_del(&mca_ptl_tcp_component.tcp_recv_event);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -589,8 +589,8 @@ static void mca_ptl_tcp_component_accept(void)
|
||||
/* wait for receipt of peers process identifier to complete this connection */
|
||||
|
||||
event = OBJ_NEW(mca_ptl_tcp_event_t);
|
||||
ompi_event_set(&event->event, sd, OMPI_EV_READ, mca_ptl_tcp_component_recv_handler, event);
|
||||
ompi_event_add(&event->event, 0);
|
||||
opal_event_set(&event->event, sd, OPAL_EV_READ, mca_ptl_tcp_component_recv_handler, event);
|
||||
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)
|
||||
{
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&ptl_peer->peer_recv_event,
|
||||
ptl_peer->peer_sd,
|
||||
OMPI_EV_READ|OMPI_EV_PERSIST,
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
mca_ptl_tcp_peer_recv_handler,
|
||||
ptl_peer);
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&ptl_peer->peer_send_event,
|
||||
ptl_peer->peer_sd,
|
||||
OMPI_EV_WRITE|OMPI_EV_PERSIST,
|
||||
OPAL_EV_WRITE|OPAL_EV_PERSIST,
|
||||
mca_ptl_tcp_peer_send_handler,
|
||||
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;
|
||||
} else {
|
||||
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 {
|
||||
/* after the first fragment - delay sending subsequent fragments to
|
||||
* enable better overlap by the scheduler
|
||||
*/
|
||||
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;
|
||||
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;
|
||||
}
|
||||
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);
|
||||
#if OMPI_ENABLE_DEBUG && WANT_PEER_DUMP
|
||||
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)
|
||||
{
|
||||
if(ptl_peer->peer_sd >= 0) {
|
||||
ompi_event_del(&ptl_peer->peer_recv_event);
|
||||
ompi_event_del(&ptl_peer->peer_send_event);
|
||||
opal_event_del(&ptl_peer->peer_recv_event);
|
||||
opal_event_del(&ptl_peer->peer_send_event);
|
||||
close(ptl_peer->peer_sd);
|
||||
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)
|
||||
ptl_peer->peer_send_frag = (mca_ptl_tcp_send_frag_t*)
|
||||
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();
|
||||
if(ompi_socket_errno == EINPROGRESS || ompi_socket_errno == EWOULDBLOCK) {
|
||||
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;
|
||||
}
|
||||
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 */
|
||||
if((rc = mca_ptl_tcp_peer_send_connect_ack(ptl_peer)) == OMPI_SUCCESS) {
|
||||
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 {
|
||||
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);
|
||||
|
||||
/* 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 */
|
||||
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();
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
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 {
|
||||
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(NULL == ptl_peer->peer_send_frag) {
|
||||
ompi_event_del(&ptl_peer->peer_send_event);
|
||||
opal_event_del(&ptl_peer->peer_send_event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ompi_output(0, "mca_ptl_tcp_peer_send_handler: invalid connection state (%d)",
|
||||
ptl_peer->peer_state);
|
||||
ompi_event_del(&ptl_peer->peer_send_event);
|
||||
opal_event_del(&ptl_peer->peer_send_event);
|
||||
break;
|
||||
}
|
||||
OPAL_THREAD_UNLOCK(&ptl_peer->peer_send_lock);
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/ptl/ptl.h"
|
||||
#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_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 */
|
||||
ompi_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_send_event; /**< event for async processing of send frags */
|
||||
opal_event_t peer_recv_event; /**< event for async processing of recv frags */
|
||||
bool peer_nbo; /**< convert headers to network byte order? */
|
||||
};
|
||||
typedef struct mca_ptl_base_peer_t mca_ptl_base_peer_t;
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "mca/ns/ns.h"
|
||||
#include "mca/rmgr/rmgr.h"
|
||||
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
|
||||
#if HAVE_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
|
||||
race conditions, keep progressing the event loop until
|
||||
we get killed */
|
||||
if (!OMPI_ENABLE_PROGRESS_THREADS || ompi_event_progress_thread()) {
|
||||
ompi_event_loop(0);
|
||||
if (!OMPI_ENABLE_PROGRESS_THREADS || opal_event_progress_thread()) {
|
||||
opal_event_loop(0);
|
||||
} else {
|
||||
sleep(1000);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "mca/schema/schema.h"
|
||||
|
||||
#include "mpi.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "group/group.h"
|
||||
#include "errhandler/errcode.h"
|
||||
#include "errhandler/errclass.h"
|
||||
@ -63,7 +63,7 @@ int ompi_mpi_finalize(void)
|
||||
|
||||
ompi_mpi_finalized = true;
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS == 0
|
||||
opal_progress_events(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_progress_events(OPAL_EVLOOP_NONBLOCK);
|
||||
#endif
|
||||
|
||||
/* 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? */
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS == 0
|
||||
opal_progress_events(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_progress_events(OPAL_EVLOOP_NONBLOCK);
|
||||
#endif
|
||||
|
||||
/* Second barrier -- wait for message from
|
||||
|
@ -337,7 +337,7 @@
|
||||
#define OMPI_ENABLE_MPI_PROFILING 1
|
||||
|
||||
/* 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 */
|
||||
#define OMPI_WANT_F90_BINDINGS 0
|
||||
|
@ -47,12 +47,12 @@
|
||||
|
||||
#include "event/compat/sys/queue.h"
|
||||
#include "event/compat/err.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
|
||||
extern struct ompi_event_list ompi_timequeue;
|
||||
extern struct ompi_event_list ompi_eventqueue;
|
||||
extern struct ompi_event_list ompi_addqueue;
|
||||
extern struct ompi_event_list ompi_signalqueue;
|
||||
extern struct opal_event_list ompi_timequeue;
|
||||
extern struct opal_event_list opal_eventqueue;
|
||||
extern struct opal_event_list ompi_addqueue;
|
||||
extern struct opal_event_list opal_signalqueue;
|
||||
|
||||
#define NEVENT 64
|
||||
|
||||
@ -66,12 +66,12 @@ void signal_process(void);
|
||||
int signal_recalc(void);
|
||||
|
||||
void *win32_init (void);
|
||||
int win32_insert (void *, struct ompi_event *);
|
||||
int win32_del (void *, struct ompi_event *);
|
||||
int win32_insert (void *, struct opal_event *);
|
||||
int win32_del (void *, struct opal_event *);
|
||||
int win32_recalc (void *, int);
|
||||
int win32_dispatch (void *, struct timeval *);
|
||||
|
||||
struct ompi_eventop ompi_win32ops = {
|
||||
struct opal_eventop opal_win32ops = {
|
||||
"win32",
|
||||
win32_init,
|
||||
win32_insert,
|
||||
@ -88,7 +88,7 @@ static int timeval_to_ms(struct timeval *tv)
|
||||
void *
|
||||
win32_init(void)
|
||||
{
|
||||
return (&ompi_win32ops);
|
||||
return (&opal_win32ops);
|
||||
}
|
||||
|
||||
int
|
||||
@ -98,13 +98,13 @@ win32_recalc(void *arg, int max)
|
||||
}
|
||||
|
||||
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 & (OMPI_EV_READ|OMPI_EV_WRITE))
|
||||
errx(1, "%s: OMPI_EV_SIGNAL incompatible use",
|
||||
if (ev->ev_events & OPAL_EV_SIGNAL) {
|
||||
if (ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE))
|
||||
errx(1, "%s: OPAL_EV_SIGNAL incompatible use",
|
||||
__FUNCTION__);
|
||||
if((int)signal(OMPI_EVENT_SIGNAL(ev), signal_handler) == -1)
|
||||
if((int)signal(OPAL_EVENT_SIGNAL(ev), signal_handler) == -1)
|
||||
return (-1);
|
||||
|
||||
return (0);
|
||||
@ -118,10 +118,10 @@ win32_dispatch(void *arg, struct timeval *tv)
|
||||
{
|
||||
int res = 0;
|
||||
struct win32op *wop = arg;
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
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));
|
||||
|
||||
if(res == WAIT_TIMEOUT || res == WAIT_FAILED) {
|
||||
@ -131,15 +131,15 @@ win32_dispatch(void *arg, struct timeval *tv)
|
||||
signal_process();
|
||||
|
||||
evres = 0;
|
||||
if(ev->ev_events & OMPI_EV_READ)
|
||||
evres |= OMPI_EV_READ;
|
||||
if(ev->ev_events & OPAL_EV_READ)
|
||||
evres |= OPAL_EV_READ;
|
||||
|
||||
if(ev->ev_events & OMPI_EV_WRITE)
|
||||
evres |= OMPI_EV_WRITE;
|
||||
if(ev->ev_events & OPAL_EV_WRITE)
|
||||
evres |= OPAL_EV_WRITE;
|
||||
if(evres) {
|
||||
if(!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
ompi_event_del(ev);
|
||||
ompi_event_active(ev, evres, 1);
|
||||
if(!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
opal_event_del(ev);
|
||||
opal_event_active(ev, evres, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,9 +150,9 @@ win32_dispatch(void *arg, struct timeval *tv)
|
||||
}
|
||||
|
||||
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)
|
||||
@ -166,11 +166,11 @@ static int signal_handler(int sig)
|
||||
int
|
||||
signal_recalc(void)
|
||||
{
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
|
||||
/* Reinstall our signal handler. */
|
||||
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) {
|
||||
if((int)signal(OMPI_EVENT_SIGNAL(ev), signal_handler) == -1)
|
||||
TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
|
||||
if((int)signal(OPAL_EVENT_SIGNAL(ev), signal_handler) == -1)
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
@ -179,15 +179,15 @@ signal_recalc(void)
|
||||
void
|
||||
signal_process(void)
|
||||
{
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
short ncalls;
|
||||
|
||||
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) {
|
||||
ncalls = evsigcaught[OMPI_EVENT_SIGNAL(ev)];
|
||||
TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
|
||||
ncalls = evsigcaught[OPAL_EVENT_SIGNAL(ev)];
|
||||
if (ncalls) {
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
ompi_event_del(ev);
|
||||
ompi_event_active(ev, OMPI_EV_SIGNAL, ncalls);
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
opal_event_del(ev);
|
||||
opal_event_active(ev, OPAL_EV_SIGNAL, ncalls);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,16 +63,16 @@
|
||||
#include "evsignal.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
|
||||
extern struct ompi_event_list ompi_eventqueue;
|
||||
extern volatile sig_atomic_t ompi_evsignal_caught;
|
||||
extern opal_mutex_t ompi_event_lock;
|
||||
extern struct opal_event_list opal_eventqueue;
|
||||
extern volatile sig_atomic_t opal_evsignal_caught;
|
||||
extern opal_mutex_t opal_event_lock;
|
||||
|
||||
/* due to limitations in the epoll interface, we need to keep track of
|
||||
* all file descriptors outself.
|
||||
*/
|
||||
struct evepoll {
|
||||
struct ompi_event *evread;
|
||||
struct ompi_event *evwrite;
|
||||
struct opal_event *evread;
|
||||
struct opal_event *evwrite;
|
||||
};
|
||||
|
||||
struct epollop {
|
||||
@ -85,12 +85,12 @@ struct epollop {
|
||||
} epollop;
|
||||
|
||||
static void *epoll_init (void);
|
||||
static int epoll_add (void *, struct ompi_event *);
|
||||
static int epoll_del (void *, struct ompi_event *);
|
||||
static int epoll_add (void *, struct opal_event *);
|
||||
static int epoll_del (void *, struct opal_event *);
|
||||
static int epoll_recalc (void *, int);
|
||||
static int epoll_dispatch (void *, struct timeval *);
|
||||
|
||||
struct ompi_eventop ompi_epollops = {
|
||||
struct opal_eventop opal_epollops = {
|
||||
"epoll",
|
||||
epoll_init,
|
||||
epoll_add,
|
||||
@ -139,7 +139,7 @@ epoll_init(void)
|
||||
}
|
||||
epollop.nfds = nfiles;
|
||||
|
||||
ompi_evsignal_init(&epollop.evsigmask);
|
||||
opal_evsignal_init(&epollop.evsigmask);
|
||||
|
||||
return (&epollop);
|
||||
}
|
||||
@ -167,7 +167,7 @@ epoll_recalc(void *arg, int max)
|
||||
epollop->nfds = nfds;
|
||||
}
|
||||
|
||||
return (ompi_evsignal_recalc(&epollop->evsigmask));
|
||||
return (opal_evsignal_recalc(&epollop->evsigmask));
|
||||
}
|
||||
|
||||
int
|
||||
@ -178,19 +178,19 @@ epoll_dispatch(void *arg, struct timeval *tv)
|
||||
struct evepoll *evep;
|
||||
int i, res, timeout;
|
||||
|
||||
if (ompi_evsignal_deliver(&epollop->evsigmask) == -1)
|
||||
if (opal_evsignal_deliver(&epollop->evsigmask) == -1)
|
||||
return (-1);
|
||||
|
||||
timeout = tv->tv_sec * 1000 + tv->tv_usec / 1000;
|
||||
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);
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
} else {
|
||||
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);
|
||||
|
||||
if (res == -1) {
|
||||
@ -199,17 +199,17 @@ epoll_dispatch(void *arg, struct timeval *tv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ompi_evsignal_process();
|
||||
opal_evsignal_process();
|
||||
return (0);
|
||||
} else if (ompi_evsignal_caught)
|
||||
ompi_evsignal_process();
|
||||
} else if (opal_evsignal_caught)
|
||||
opal_evsignal_process();
|
||||
|
||||
LOG_DBG((LOG_MISC, 80, "%s: epoll_wait reports %d", __func__, res));
|
||||
|
||||
for (i = 0; i < res; i++) {
|
||||
int which = 0;
|
||||
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;
|
||||
|
||||
@ -220,27 +220,27 @@ epoll_dispatch(void *arg, struct timeval *tv)
|
||||
|
||||
if (what & EPOLLIN) {
|
||||
evread = evep->evread;
|
||||
which |= OMPI_EV_READ;
|
||||
which |= OPAL_EV_READ;
|
||||
}
|
||||
|
||||
if (what & EPOLLOUT) {
|
||||
evwrite = evep->evwrite;
|
||||
which |= OMPI_EV_WRITE;
|
||||
which |= OPAL_EV_WRITE;
|
||||
}
|
||||
|
||||
if (!which)
|
||||
continue;
|
||||
|
||||
if (evread != NULL && !(evread->ev_events & OMPI_EV_PERSIST))
|
||||
ompi_event_del_i(evread);
|
||||
if (evread != NULL && !(evread->ev_events & OPAL_EV_PERSIST))
|
||||
opal_event_del_i(evread);
|
||||
if (evwrite != NULL && evwrite != evread &&
|
||||
!(evwrite->ev_events & OMPI_EV_PERSIST))
|
||||
ompi_event_del_i(evwrite);
|
||||
!(evwrite->ev_events & OPAL_EV_PERSIST))
|
||||
opal_event_del_i(evwrite);
|
||||
|
||||
if (evread != NULL)
|
||||
ompi_event_active_i(evread, OMPI_EV_READ, 1);
|
||||
opal_event_active_i(evread, OPAL_EV_READ, 1);
|
||||
if (evwrite != NULL)
|
||||
ompi_event_active_i(evwrite, OMPI_EV_WRITE, 1);
|
||||
opal_event_active_i(evwrite, OPAL_EV_WRITE, 1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -248,15 +248,15 @@ epoll_dispatch(void *arg, struct timeval *tv)
|
||||
|
||||
|
||||
static int
|
||||
epoll_add(void *arg, struct ompi_event *ev)
|
||||
epoll_add(void *arg, struct opal_event *ev)
|
||||
{
|
||||
struct epollop *epollop = arg;
|
||||
struct epoll_event epev;
|
||||
struct evepoll *evep;
|
||||
int fd, op, events;
|
||||
|
||||
if (ev->ev_events & OMPI_EV_SIGNAL)
|
||||
return (ompi_evsignal_add(&epollop->evsigmask, ev));
|
||||
if (ev->ev_events & OPAL_EV_SIGNAL)
|
||||
return (opal_evsignal_add(&epollop->evsigmask, ev));
|
||||
|
||||
fd = ev->ev_fd;
|
||||
if (fd >= epollop->nfds) {
|
||||
@ -276,9 +276,9 @@ epoll_add(void *arg, struct ompi_event *ev)
|
||||
op = EPOLL_CTL_MOD;
|
||||
}
|
||||
|
||||
if (ev->ev_events & OMPI_EV_READ)
|
||||
if (ev->ev_events & OPAL_EV_READ)
|
||||
events |= EPOLLIN;
|
||||
if (ev->ev_events & OMPI_EV_WRITE)
|
||||
if (ev->ev_events & OPAL_EV_WRITE)
|
||||
events |= EPOLLOUT;
|
||||
|
||||
epev.data.ptr = evep;
|
||||
@ -287,16 +287,16 @@ epoll_add(void *arg, struct ompi_event *ev)
|
||||
return (-1);
|
||||
|
||||
/* Update events responsible */
|
||||
if (ev->ev_events & OMPI_EV_READ)
|
||||
if (ev->ev_events & OPAL_EV_READ)
|
||||
evep->evread = ev;
|
||||
if (ev->ev_events & OMPI_EV_WRITE)
|
||||
if (ev->ev_events & OPAL_EV_WRITE)
|
||||
evep->evwrite = ev;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
epoll_del(void *arg, struct ompi_event *ev)
|
||||
epoll_del(void *arg, struct opal_event *ev)
|
||||
{
|
||||
struct epollop *epollop = arg;
|
||||
struct epoll_event epev;
|
||||
@ -304,8 +304,8 @@ epoll_del(void *arg, struct ompi_event *ev)
|
||||
int fd, events, op;
|
||||
int needwritedelete = 1, needreaddelete = 1;
|
||||
|
||||
if (ev->ev_events & OMPI_EV_SIGNAL)
|
||||
return (ompi_evsignal_del(&epollop->evsigmask, ev));
|
||||
if (ev->ev_events & OPAL_EV_SIGNAL)
|
||||
return (opal_evsignal_del(&epollop->evsigmask, ev));
|
||||
|
||||
fd = ev->ev_fd;
|
||||
if (fd >= epollop->nfds)
|
||||
@ -315,9 +315,9 @@ epoll_del(void *arg, struct ompi_event *ev)
|
||||
op = EPOLL_CTL_DEL;
|
||||
events = 0;
|
||||
|
||||
if (ev->ev_events & OMPI_EV_READ)
|
||||
if (ev->ev_events & OPAL_EV_READ)
|
||||
events |= EPOLLIN;
|
||||
if (ev->ev_events & OMPI_EV_WRITE)
|
||||
if (ev->ev_events & OPAL_EV_WRITE)
|
||||
events |= EPOLLOUT;
|
||||
|
||||
if ((events & (EPOLLIN|EPOLLOUT)) != (EPOLLIN|EPOLLOUT)) {
|
||||
|
@ -67,19 +67,19 @@
|
||||
#include "util/output.h"
|
||||
|
||||
#if defined(HAVE_SELECT) && HAVE_SELECT
|
||||
extern const struct ompi_eventop ompi_selectops;
|
||||
extern const struct opal_eventop opal_selectops;
|
||||
#endif
|
||||
#if defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL
|
||||
extern const struct ompi_eventop ompi_pollops;
|
||||
extern const struct opal_eventop opal_pollops;
|
||||
#endif
|
||||
#if defined(HAVE_RTSIG) && HAVE_RTSIG
|
||||
extern const struct ompi_eventop ompi_rtsigops;
|
||||
extern const struct opal_eventop opal_rtsigops;
|
||||
#endif
|
||||
#if defined(HAVE_EPOLL) && HAVE_EPOLL
|
||||
extern const struct ompi_eventop ompi_epollops;
|
||||
extern const struct opal_eventop opal_epollops;
|
||||
#endif
|
||||
#if defined(HAVE_WORKING_KQUEUE) && HAVE_WORKING_KQUEUE
|
||||
extern const struct ompi_eventop ompi_kqops;
|
||||
extern const struct opal_eventop opal_kqops;
|
||||
#endif
|
||||
#if 0
|
||||
/* 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
|
||||
this to work */
|
||||
#if defined(WIN32) && WIN32
|
||||
extern const struct ompi_eventop ompi_win32ops;
|
||||
extern const struct opal_eventop opal_win32ops;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* In order of preference */
|
||||
static const struct ompi_eventop *ompi_eventops[] = {
|
||||
static const struct opal_eventop *opal_eventops[] = {
|
||||
#if 0
|
||||
#if HAVE_WORKING_KQUEUE
|
||||
&ompi_kqops,
|
||||
&opal_kqops,
|
||||
#endif
|
||||
#if HAVE_EPOLL
|
||||
&ompi_epollops,
|
||||
&opal_epollops,
|
||||
#endif
|
||||
#if HAVE_RTSIG
|
||||
&ompi_rtsigops,
|
||||
&opal_rtsigops,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL
|
||||
&ompi_pollops,
|
||||
&opal_pollops,
|
||||
#endif
|
||||
#if defined(HAVE_SELECT) && HAVE_SELECT
|
||||
&ompi_selectops,
|
||||
&opal_selectops,
|
||||
#endif
|
||||
#if 0
|
||||
/* 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
|
||||
this to work */
|
||||
#if defined(WIN32) && WIN32
|
||||
&ompi_win32ops,
|
||||
&opal_win32ops,
|
||||
#endif
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
const struct ompi_eventop *ompi_evsel;
|
||||
void *ompi_evbase;
|
||||
const struct opal_eventop *opal_evsel;
|
||||
void *opal_evbase;
|
||||
|
||||
/* Handle signals */
|
||||
int (*ompi_event_sigcb)(void); /* Signal callback when gotsig is set */
|
||||
int ompi_event_gotsig; /* Set in signal handler */
|
||||
int (*opal_event_sigcb)(void); /* Signal callback when gotsig is set */
|
||||
int opal_event_gotsig; /* Set in signal handler */
|
||||
|
||||
/* Prototypes */
|
||||
static void ompi_event_process_active(void);
|
||||
static void ompi_timeout_correct(struct timeval *off);
|
||||
static void ompi_timeout_insert(struct ompi_event *);
|
||||
static void ompi_event_queue_insert(struct ompi_event *, int);
|
||||
static void ompi_event_queue_remove(struct ompi_event *, int);
|
||||
static void ompi_timeout_process(void);
|
||||
int ompi_event_haveevents(void);
|
||||
bool ompi_event_progress_thread(void);
|
||||
extern int ompi_evsignal_restart(void);
|
||||
static void opal_event_process_active(void);
|
||||
static void opal_timeout_correct(struct timeval *off);
|
||||
static void opal_timeout_insert(struct opal_event *);
|
||||
static void opal_event_queue_insert(struct opal_event *, int);
|
||||
static void opal_event_queue_remove(struct opal_event *, int);
|
||||
static void opal_timeout_process(void);
|
||||
int opal_event_haveevents(void);
|
||||
bool opal_event_progress_thread(void);
|
||||
extern int opal_evsignal_restart(void);
|
||||
|
||||
static RB_HEAD(ompi_event_tree, ompi_event) ompi_timetree;
|
||||
static struct ompi_event_list ompi_activequeue;
|
||||
struct ompi_event_list ompi_signalqueue;
|
||||
struct ompi_event_list ompi_eventqueue;
|
||||
static struct timeval ompi_event_tv;
|
||||
OMPI_DECLSPEC opal_mutex_t ompi_event_lock;
|
||||
static int ompi_event_inited = 0;
|
||||
static bool ompi_event_enabled = false;
|
||||
static RB_HEAD(opal_event_tree, opal_event) opal_timetree;
|
||||
static struct opal_event_list opal_activequeue;
|
||||
struct opal_event_list opal_signalqueue;
|
||||
struct opal_event_list opal_eventqueue;
|
||||
static struct timeval opal_event_tv;
|
||||
OMPI_DECLSPEC opal_mutex_t opal_event_lock;
|
||||
static int opal_event_inited = 0;
|
||||
static bool opal_event_enabled = false;
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
static opal_thread_t ompi_event_thread;
|
||||
static ompi_event_t ompi_event_pipe_event;
|
||||
static int ompi_event_pipe[2];
|
||||
static int ompi_event_pipe_signalled;
|
||||
static opal_thread_t opal_event_thread;
|
||||
static opal_event_t opal_event_pipe_event;
|
||||
static int opal_event_pipe[2];
|
||||
static int opal_event_pipe_signalled;
|
||||
#endif
|
||||
|
||||
bool ompi_event_progress_thread(void)
|
||||
bool opal_event_progress_thread(void)
|
||||
{
|
||||
#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
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
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, <))
|
||||
return (-1);
|
||||
@ -174,20 +174,20 @@ compare(struct ompi_event *a, struct ompi_event *b)
|
||||
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
|
||||
/* Open MPI: JMS As far as I can tell, this function is not used
|
||||
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 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;
|
||||
return(0);
|
||||
}
|
||||
@ -207,69 +207,69 @@ static int ompi_timeout_next(struct timeval *tv)
|
||||
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
/* 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 */
|
||||
#if defined(NDEBUG)
|
||||
ompi_event_loop(0);
|
||||
opal_event_loop(0);
|
||||
#else
|
||||
int rc = ompi_event_loop(0);
|
||||
int rc = opal_event_loop(0);
|
||||
assert(rc >= 0);
|
||||
#endif
|
||||
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
ompi_event_del_i(&ompi_event_pipe_event);
|
||||
close(ompi_event_pipe[0]);
|
||||
close(ompi_event_pipe[1]);
|
||||
ompi_event_pipe[0] = -1;
|
||||
ompi_event_pipe[1] = -1;
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
opal_event_del_i(&opal_event_pipe_event);
|
||||
close(opal_event_pipe[0]);
|
||||
close(opal_event_pipe[1]);
|
||||
opal_event_pipe[0] = -1;
|
||||
opal_event_pipe[1] = -1;
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
#endif /* 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;
|
||||
if(read(sd, &byte, 1) < 0) {
|
||||
ompi_output(0, "ompi_event_pipe: read failed with: errno=%d\n", errno);
|
||||
ompi_event_del(&ompi_event_pipe_event);
|
||||
ompi_output(0, "opal_event_pipe: read failed with: errno=%d\n", errno);
|
||||
opal_event_del(&opal_event_pipe_event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
ompi_event_init(void)
|
||||
opal_event_init(void)
|
||||
{
|
||||
int i;
|
||||
if(ompi_event_inited++ != 0)
|
||||
if(opal_event_inited++ != 0)
|
||||
return OMPI_SUCCESS;
|
||||
|
||||
ompi_event_sigcb = NULL;
|
||||
ompi_event_gotsig = 0;
|
||||
gettimeofday(&ompi_event_tv, NULL);
|
||||
opal_event_sigcb = NULL;
|
||||
opal_event_gotsig = 0;
|
||||
gettimeofday(&opal_event_tv, NULL);
|
||||
|
||||
OBJ_CONSTRUCT(&ompi_event_lock, opal_mutex_t);
|
||||
RB_INIT(&ompi_timetree);
|
||||
TAILQ_INIT(&ompi_eventqueue);
|
||||
TAILQ_INIT(&ompi_activequeue);
|
||||
TAILQ_INIT(&ompi_signalqueue);
|
||||
OBJ_CONSTRUCT(&opal_event_lock, opal_mutex_t);
|
||||
RB_INIT(&opal_timetree);
|
||||
TAILQ_INIT(&opal_eventqueue);
|
||||
TAILQ_INIT(&opal_activequeue);
|
||||
TAILQ_INIT(&opal_signalqueue);
|
||||
|
||||
ompi_evbase = NULL;
|
||||
for (i = 0; ompi_eventops[i] && !ompi_evbase; i++) {
|
||||
ompi_evsel = ompi_eventops[i];
|
||||
ompi_evbase = ompi_evsel->init();
|
||||
opal_evbase = NULL;
|
||||
for (i = 0; opal_eventops[i] && !opal_evbase; i++) {
|
||||
opal_evsel = opal_eventops[i];
|
||||
opal_evbase = opal_evsel->init();
|
||||
}
|
||||
|
||||
if (ompi_evbase == NULL)
|
||||
if (opal_evbase == NULL)
|
||||
errx(1, "%s: no event mechanism available", __func__);
|
||||
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
#endif
|
||||
ompi_event_enable();
|
||||
opal_event_enable();
|
||||
|
||||
#if defined(USE_LOG) && defined(USE_DEBUG)
|
||||
log_to(stderr);
|
||||
@ -278,129 +278,129 @@ ompi_event_init(void)
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_event_fini(void)
|
||||
int opal_event_fini(void)
|
||||
{
|
||||
ompi_event_disable();
|
||||
ompi_event_inited--;
|
||||
opal_event_disable();
|
||||
opal_event_inited--;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_event_disable(void)
|
||||
int opal_event_disable(void)
|
||||
{
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
if(opal_using_threads()) {
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
if(ompi_event_inited > 0 && ompi_event_enabled == false) {
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
if(opal_event_inited > 0 && opal_event_enabled == false) {
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
ompi_event_enabled = false;
|
||||
if(ompi_event_pipe_signalled == 0) {
|
||||
opal_event_enabled = false;
|
||||
if(opal_event_pipe_signalled == 0) {
|
||||
unsigned char byte = 0;
|
||||
if(write(ompi_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_event_pipe_signalled++;
|
||||
if(write(opal_event_pipe[1], &byte, 1) != 1)
|
||||
ompi_output(0, "opal_event_add: write() to opal_event_pipe[1] failed with errno=%d\n", errno);
|
||||
opal_event_pipe_signalled++;
|
||||
}
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_thread_join(&ompi_event_thread, NULL);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
opal_thread_join(&opal_event_thread, NULL);
|
||||
} else {
|
||||
ompi_event_enabled = false;
|
||||
opal_event_enabled = false;
|
||||
}
|
||||
#else
|
||||
ompi_event_enabled = false;
|
||||
opal_event_enabled = false;
|
||||
#endif
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_event_enable(void)
|
||||
int opal_event_enable(void)
|
||||
{
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
if(opal_using_threads()) {
|
||||
int rc;
|
||||
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
if(ompi_event_inited > 0 && ompi_event_enabled == true) {
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
if(opal_event_inited > 0 && opal_event_enabled == true) {
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
/* create a pipe to signal the event thread */
|
||||
if(pipe(ompi_event_pipe) != 0) {
|
||||
ompi_output(0, "ompi_event_init: pipe() failed with errno=%d\n", errno);
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
if(pipe(opal_event_pipe) != 0) {
|
||||
ompi_output(0, "opal_event_init: pipe() failed with errno=%d\n", errno);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
ompi_event_pipe_signalled = 1;
|
||||
ompi_event_set(
|
||||
&ompi_event_pipe_event,
|
||||
ompi_event_pipe[0],
|
||||
OMPI_EV_READ|OMPI_EV_PERSIST,
|
||||
ompi_event_pipe_handler,
|
||||
opal_event_pipe_signalled = 1;
|
||||
opal_event_set(
|
||||
&opal_event_pipe_event,
|
||||
opal_event_pipe[0],
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
opal_event_pipe_handler,
|
||||
0);
|
||||
ompi_event_add_i(&ompi_event_pipe_event, 0);
|
||||
ompi_event_pipe_signalled = 0;
|
||||
opal_event_add_i(&opal_event_pipe_event, 0);
|
||||
opal_event_pipe_signalled = 0;
|
||||
|
||||
/* spin up a thread to dispatch events */
|
||||
OBJ_CONSTRUCT(&ompi_event_thread, opal_thread_t);
|
||||
ompi_event_enabled = true;
|
||||
ompi_event_thread.t_run = ompi_event_run;
|
||||
if((rc = opal_thread_start(&ompi_event_thread)) != OMPI_SUCCESS) {
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
OBJ_CONSTRUCT(&opal_event_thread, opal_thread_t);
|
||||
opal_event_enabled = true;
|
||||
opal_event_thread.t_run = opal_event_run;
|
||||
if((rc = opal_thread_start(&opal_event_thread)) != OMPI_SUCCESS) {
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return rc;
|
||||
}
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
} else {
|
||||
ompi_event_pipe[0] = -1;
|
||||
ompi_event_pipe[1] = -1;
|
||||
ompi_event_enabled = true;
|
||||
opal_event_pipe[0] = -1;
|
||||
opal_event_pipe[1] = -1;
|
||||
opal_event_enabled = true;
|
||||
}
|
||||
#else
|
||||
ompi_event_enabled = true;
|
||||
opal_event_enabled = true;
|
||||
#endif
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
int ompi_event_restart(void)
|
||||
int opal_event_restart(void)
|
||||
{
|
||||
int rc;
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
if(ompi_event_pipe[0] >= 0) {
|
||||
ompi_event_del_i(&ompi_event_pipe_event);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
if(opal_event_pipe[0] >= 0) {
|
||||
opal_event_del_i(&opal_event_pipe_event);
|
||||
/* do not close pipes - in case of bproc_vrfork they are not open
|
||||
* and we may close something else
|
||||
*/
|
||||
ompi_event_pipe[0] = -1;
|
||||
ompi_event_pipe[1] = -1;
|
||||
opal_event_pipe[0] = -1;
|
||||
opal_event_pipe[1] = -1;
|
||||
}
|
||||
ompi_event_enabled = false;
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_event_enabled = false;
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
#endif
|
||||
|
||||
ompi_event_enable();
|
||||
if((rc = ompi_evsignal_restart()) != 0)
|
||||
opal_event_enable();
|
||||
if((rc = opal_evsignal_restart()) != 0)
|
||||
return OMPI_ERROR;
|
||||
return (OMPI_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
int ompi_event_haveevents(void)
|
||||
int opal_event_haveevents(void)
|
||||
{
|
||||
return (RB_ROOT(&ompi_timetree) || TAILQ_FIRST(&ompi_eventqueue) ||
|
||||
TAILQ_FIRST(&ompi_signalqueue) || TAILQ_FIRST(&ompi_activequeue));
|
||||
return (RB_ROOT(&opal_timetree) || TAILQ_FIRST(&opal_eventqueue) ||
|
||||
TAILQ_FIRST(&opal_signalqueue) || TAILQ_FIRST(&opal_activequeue));
|
||||
}
|
||||
|
||||
static void
|
||||
ompi_event_process_active(void)
|
||||
opal_event_process_active(void)
|
||||
{
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
short ncalls;
|
||||
|
||||
for (ev = TAILQ_FIRST(&ompi_activequeue); ev;
|
||||
ev = TAILQ_FIRST(&ompi_activequeue)) {
|
||||
ompi_event_queue_remove(ev, OMPI_EVLIST_ACTIVE);
|
||||
for (ev = TAILQ_FIRST(&opal_activequeue); ev;
|
||||
ev = TAILQ_FIRST(&opal_activequeue)) {
|
||||
opal_event_queue_remove(ev, OPAL_EVLIST_ACTIVE);
|
||||
|
||||
/* Allows deletes to work */
|
||||
ncalls = ev->ev_ncalls;
|
||||
@ -409,9 +409,9 @@ ompi_event_process_active(void)
|
||||
ncalls--;
|
||||
ev->ev_ncalls = ncalls;
|
||||
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);
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
} else {
|
||||
(*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg);
|
||||
}
|
||||
@ -420,126 +420,126 @@ ompi_event_process_active(void)
|
||||
}
|
||||
|
||||
int
|
||||
ompi_event_dispatch(void)
|
||||
opal_event_dispatch(void)
|
||||
{
|
||||
return (ompi_event_loop(0));
|
||||
return (opal_event_loop(0));
|
||||
}
|
||||
|
||||
int
|
||||
ompi_event_loop(int flags)
|
||||
opal_event_loop(int flags)
|
||||
{
|
||||
struct timeval tv;
|
||||
int res, done;
|
||||
int num_active = 0;
|
||||
|
||||
if (ompi_event_inited == false)
|
||||
if (opal_event_inited == false)
|
||||
return(0);
|
||||
|
||||
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 */
|
||||
if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) {
|
||||
ompi_output(0, "ompi_event_loop: ompi_evsel->recalc() failed.");
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
if (opal_evsel->recalc && opal_evsel->recalc(opal_evbase, 0) == -1) {
|
||||
ompi_output(0, "opal_event_loop: opal_evsel->recalc() failed.");
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
done = 0;
|
||||
while (!done && ompi_event_enabled) {
|
||||
while (ompi_event_gotsig) {
|
||||
ompi_event_gotsig = 0;
|
||||
if (ompi_event_sigcb) {
|
||||
res = (*ompi_event_sigcb)();
|
||||
while (!done && opal_event_enabled) {
|
||||
while (opal_event_gotsig) {
|
||||
opal_event_gotsig = 0;
|
||||
if (opal_event_sigcb) {
|
||||
res = (*opal_event_sigcb)();
|
||||
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;
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & OMPI_EVLOOP_NONBLOCK)) {
|
||||
static struct timeval dflt = OMPI_TIMEOUT_DEFAULT;
|
||||
if (!(flags & OPAL_EVLOOP_NONBLOCK)) {
|
||||
static struct timeval dflt = OPAL_TIMEOUT_DEFAULT;
|
||||
tv = dflt;
|
||||
} else
|
||||
timerclear(&tv);
|
||||
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
ompi_event_pipe_signalled = 0;
|
||||
opal_event_pipe_signalled = 0;
|
||||
#endif
|
||||
res = ompi_evsel->dispatch(ompi_evbase, &tv);
|
||||
res = opal_evsel->dispatch(opal_evbase, &tv);
|
||||
#if OMPI_ENABLE_PROGRESS_THREADS
|
||||
ompi_event_pipe_signalled = 1;
|
||||
opal_event_pipe_signalled = 1;
|
||||
#endif
|
||||
if (res == -1) {
|
||||
ompi_output(0, "ompi_event_loop: ompi_evesel->dispatch() failed.");
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
ompi_output(0, "opal_event_loop: ompi_evesel->dispatch() failed.");
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
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 */
|
||||
gettimeofday(&tv, NULL);
|
||||
if (timercmp(&tv, &ompi_event_tv, <)) {
|
||||
if (timercmp(&tv, &opal_event_tv, <)) {
|
||||
struct timeval off;
|
||||
LOG_DBG((LOG_MISC, 10,
|
||||
"%s: time is running backwards, corrected",
|
||||
__func__));
|
||||
|
||||
timersub(&ompi_event_tv, &tv, &off);
|
||||
ompi_timeout_correct(&off);
|
||||
timersub(&opal_event_tv, &tv, &off);
|
||||
opal_timeout_correct(&off);
|
||||
}
|
||||
ompi_event_tv = tv;
|
||||
ompi_timeout_process();
|
||||
opal_event_tv = tv;
|
||||
opal_timeout_process();
|
||||
}
|
||||
|
||||
if (TAILQ_FIRST(&ompi_activequeue)) {
|
||||
if (TAILQ_FIRST(&opal_activequeue)) {
|
||||
num_active++;
|
||||
ompi_event_process_active();
|
||||
if (flags & OMPI_EVLOOP_ONCE)
|
||||
opal_event_process_active();
|
||||
if (flags & OPAL_EVLOOP_ONCE)
|
||||
done = 1;
|
||||
} else if (flags & (OMPI_EVLOOP_NONBLOCK|OMPI_EVLOOP_ONCE))
|
||||
} else if (flags & (OPAL_EVLOOP_NONBLOCK|OPAL_EVLOOP_ONCE))
|
||||
done = 1;
|
||||
|
||||
if (ompi_evsel->recalc && ompi_evsel->recalc(ompi_evbase, 0) == -1) {
|
||||
ompi_output(0, "ompi_event_loop: ompi_evesel->recalc() failed.");
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
if (opal_evsel->recalc && opal_evsel->recalc(opal_evbase, 0) == -1) {
|
||||
ompi_output(0, "opal_event_loop: ompi_evesel->recalc() failed.");
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
return (num_active);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
LOG_DBG((LOG_MISC, 55,
|
||||
"event_add: event: %p, %s%s%scall %p",
|
||||
ev,
|
||||
ev->ev_events & OMPI_EV_READ ? "OMPI_EV_READ " : " ",
|
||||
ev->ev_events & OMPI_EV_WRITE ? "OMPI_EV_WRITE " : " ",
|
||||
tv ? "OMPI_EV_TIMEOUT " : " ",
|
||||
ev->ev_events & OPAL_EV_READ ? "OPAL_EV_READ " : " ",
|
||||
ev->ev_events & OPAL_EV_WRITE ? "OPAL_EV_WRITE " : " ",
|
||||
tv ? "OPAL_EV_TIMEOUT " : " ",
|
||||
ev->ev_callback));
|
||||
|
||||
assert(!(ev->ev_flags & ~OMPI_EVLIST_ALL));
|
||||
assert(!(ev->ev_flags & ~OPAL_EVLIST_ALL));
|
||||
|
||||
if (tv != NULL) {
|
||||
struct timeval now;
|
||||
|
||||
if (ev->ev_flags & OMPI_EVLIST_TIMEOUT)
|
||||
ompi_event_queue_remove(ev, OMPI_EVLIST_TIMEOUT);
|
||||
if (ev->ev_flags & OPAL_EVLIST_TIMEOUT)
|
||||
opal_event_queue_remove(ev, OPAL_EVLIST_TIMEOUT);
|
||||
|
||||
/* Check if it is active due to a timeout. Rescheduling
|
||||
* this timeout before the callback can be executed
|
||||
* removes it from the active list. */
|
||||
if ((ev->ev_flags & OMPI_EVLIST_ACTIVE) &&
|
||||
(ev->ev_res & OMPI_EV_TIMEOUT)) {
|
||||
if ((ev->ev_flags & OPAL_EVLIST_ACTIVE) &&
|
||||
(ev->ev_res & OPAL_EV_TIMEOUT)) {
|
||||
/* See if we are just active executing this
|
||||
* event in a loop
|
||||
*/
|
||||
@ -548,7 +548,7 @@ ompi_event_add_i(struct ompi_event *ev, struct timeval *tv)
|
||||
*ev->ev_pncalls = 0;
|
||||
}
|
||||
|
||||
ompi_event_queue_remove(ev, OMPI_EVLIST_ACTIVE);
|
||||
opal_event_queue_remove(ev, OPAL_EVLIST_ACTIVE);
|
||||
}
|
||||
|
||||
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",
|
||||
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)) &&
|
||||
!(ev->ev_flags & (OMPI_EVLIST_INSERTED|OMPI_EVLIST_ACTIVE))) {
|
||||
ompi_event_queue_insert(ev, OMPI_EVLIST_INSERTED);
|
||||
rc = (ompi_evsel->add(ompi_evbase, ev));
|
||||
} else if ((ev->ev_events & OMPI_EV_SIGNAL) &&
|
||||
!(ev->ev_flags & OMPI_EVLIST_SIGNAL)) {
|
||||
ompi_event_queue_insert(ev, OMPI_EVLIST_SIGNAL);
|
||||
rc = (ompi_evsel->add(ompi_evbase, ev));
|
||||
if ((ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE)) &&
|
||||
!(ev->ev_flags & (OPAL_EVLIST_INSERTED|OPAL_EVLIST_ACTIVE))) {
|
||||
opal_event_queue_insert(ev, OPAL_EVLIST_INSERTED);
|
||||
rc = (opal_evsel->add(opal_evbase, ev));
|
||||
} else if ((ev->ev_events & OPAL_EV_SIGNAL) &&
|
||||
!(ev->ev_flags & OPAL_EVLIST_SIGNAL)) {
|
||||
opal_event_queue_insert(ev, OPAL_EVLIST_SIGNAL);
|
||||
rc = (opal_evsel->add(opal_evbase, ev));
|
||||
}
|
||||
|
||||
#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;
|
||||
if(write(ompi_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_event_pipe_signalled++;
|
||||
if(write(opal_event_pipe[1], &byte, 1) != 1)
|
||||
ompi_output(0, "opal_event_add: write() to opal_event_pipe[1] failed with errno=%d\n", errno);
|
||||
opal_event_pipe_signalled++;
|
||||
}
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int ompi_event_del_i(struct ompi_event *ev)
|
||||
int opal_event_del_i(struct opal_event *ev)
|
||||
{
|
||||
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 */
|
||||
if (ev->ev_ncalls && ev->ev_pncalls) {
|
||||
@ -594,26 +594,26 @@ int ompi_event_del_i(struct ompi_event *ev)
|
||||
*ev->ev_pncalls = 0;
|
||||
}
|
||||
|
||||
if (ev->ev_flags & OMPI_EVLIST_TIMEOUT)
|
||||
ompi_event_queue_remove(ev, OMPI_EVLIST_TIMEOUT);
|
||||
if (ev->ev_flags & OPAL_EVLIST_TIMEOUT)
|
||||
opal_event_queue_remove(ev, OPAL_EVLIST_TIMEOUT);
|
||||
|
||||
if (ev->ev_flags & OMPI_EVLIST_ACTIVE)
|
||||
ompi_event_queue_remove(ev, OMPI_EVLIST_ACTIVE);
|
||||
if (ev->ev_flags & OPAL_EVLIST_ACTIVE)
|
||||
opal_event_queue_remove(ev, OPAL_EVLIST_ACTIVE);
|
||||
|
||||
if (ev->ev_flags & OMPI_EVLIST_INSERTED) {
|
||||
ompi_event_queue_remove(ev, OMPI_EVLIST_INSERTED);
|
||||
rc = (ompi_evsel->del(ompi_evbase, ev));
|
||||
} else if (ev->ev_flags & OMPI_EVLIST_SIGNAL) {
|
||||
ompi_event_queue_remove(ev, OMPI_EVLIST_SIGNAL);
|
||||
rc = (ompi_evsel->del(ompi_evbase, ev));
|
||||
if (ev->ev_flags & OPAL_EVLIST_INSERTED) {
|
||||
opal_event_queue_remove(ev, OPAL_EVLIST_INSERTED);
|
||||
rc = (opal_evsel->del(opal_evbase, ev));
|
||||
} else if (ev->ev_flags & OPAL_EVLIST_SIGNAL) {
|
||||
opal_event_queue_remove(ev, OPAL_EVLIST_SIGNAL);
|
||||
rc = (opal_evsel->del(opal_evbase, ev));
|
||||
}
|
||||
|
||||
#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;
|
||||
if(write(ompi_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_event_pipe_signalled++;
|
||||
if(write(opal_event_pipe[1], &byte, 1) != 1)
|
||||
ompi_output(0, "opal_event_add: write() to opal_event_pipe[1] failed with errno=%d\n", errno);
|
||||
opal_event_pipe_signalled++;
|
||||
}
|
||||
#endif
|
||||
return (rc);
|
||||
@ -621,48 +621,48 @@ int ompi_event_del_i(struct ompi_event *ev)
|
||||
|
||||
|
||||
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
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ompi_timeout_process(void)
|
||||
opal_timeout_process(void)
|
||||
{
|
||||
struct timeval now;
|
||||
struct ompi_event *ev, *next;
|
||||
struct opal_event *ev, *next;
|
||||
|
||||
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, >))
|
||||
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 */
|
||||
ompi_event_del_i(ev);
|
||||
opal_event_del_i(ev);
|
||||
|
||||
LOG_DBG((LOG_MISC, 60, "timeout_process: call %p",
|
||||
ev->ev_callback));
|
||||
ompi_event_active_i(ev, OMPI_EV_TIMEOUT, 1);
|
||||
opal_event_active_i(ev, OPAL_EV_TIMEOUT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
struct timeval tv;
|
||||
@ -672,18 +672,18 @@ ompi_timeout_insert(struct ompi_event *ev)
|
||||
tv = ev->ev_timeout;
|
||||
do {
|
||||
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, ==));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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))
|
||||
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;
|
||||
switch (queue) {
|
||||
case OMPI_EVLIST_ACTIVE:
|
||||
TAILQ_REMOVE(&ompi_activequeue, ev, ev_active_next);
|
||||
case OPAL_EVLIST_ACTIVE:
|
||||
TAILQ_REMOVE(&opal_activequeue, ev, ev_active_next);
|
||||
break;
|
||||
case OMPI_EVLIST_SIGNAL:
|
||||
TAILQ_REMOVE(&ompi_signalqueue, ev, ev_signal_next);
|
||||
case OPAL_EVLIST_SIGNAL:
|
||||
TAILQ_REMOVE(&opal_signalqueue, ev, ev_signal_next);
|
||||
break;
|
||||
case OMPI_EVLIST_TIMEOUT:
|
||||
RB_REMOVE(ompi_event_tree, &ompi_timetree, ev);
|
||||
case OPAL_EVLIST_TIMEOUT:
|
||||
RB_REMOVE(opal_event_tree, &opal_timetree, ev);
|
||||
break;
|
||||
case OMPI_EVLIST_INSERTED:
|
||||
TAILQ_REMOVE(&ompi_eventqueue, ev, ev_next);
|
||||
case OPAL_EVLIST_INSERTED:
|
||||
TAILQ_REMOVE(&opal_eventqueue, ev, ev_next);
|
||||
break;
|
||||
default:
|
||||
errx(1, "%s: unknown queue %x", __func__, queue);
|
||||
@ -709,7 +709,7 @@ ompi_event_queue_remove(struct ompi_event *ev, int queue)
|
||||
}
|
||||
|
||||
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)
|
||||
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;
|
||||
switch (queue) {
|
||||
case OMPI_EVLIST_ACTIVE:
|
||||
TAILQ_INSERT_TAIL(&ompi_activequeue, ev, ev_active_next);
|
||||
case OPAL_EVLIST_ACTIVE:
|
||||
TAILQ_INSERT_TAIL(&opal_activequeue, ev, ev_active_next);
|
||||
break;
|
||||
case OMPI_EVLIST_SIGNAL:
|
||||
TAILQ_INSERT_TAIL(&ompi_signalqueue, ev, ev_signal_next);
|
||||
case OPAL_EVLIST_SIGNAL:
|
||||
TAILQ_INSERT_TAIL(&opal_signalqueue, ev, ev_signal_next);
|
||||
break;
|
||||
case OMPI_EVLIST_TIMEOUT:
|
||||
ompi_timeout_insert(ev);
|
||||
case OPAL_EVLIST_TIMEOUT:
|
||||
opal_timeout_insert(ev);
|
||||
break;
|
||||
case OMPI_EVLIST_INSERTED:
|
||||
TAILQ_INSERT_TAIL(&ompi_eventqueue, ev, ev_next);
|
||||
case OPAL_EVLIST_INSERTED:
|
||||
TAILQ_INSERT_TAIL(&opal_eventqueue, ev, ev_next);
|
||||
break;
|
||||
default:
|
||||
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 */
|
||||
if (ev->ev_flags & OMPI_EVLIST_ACTIVE) {
|
||||
if (ev->ev_flags & OPAL_EVLIST_ACTIVE) {
|
||||
ev->ev_res |= res;
|
||||
return;
|
||||
}
|
||||
@ -745,7 +745,7 @@ void ompi_event_active_i(struct ompi_event * ev, int res, short ncalls)
|
||||
ev->ev_res = res;
|
||||
ev->ev_ncalls = ncalls;
|
||||
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>
|
||||
#endif
|
||||
|
||||
#define OMPI_EVLIST_TIMEOUT 0x01
|
||||
#define OMPI_EVLIST_INSERTED 0x02
|
||||
#define OMPI_EVLIST_SIGNAL 0x04
|
||||
#define OMPI_EVLIST_ACTIVE 0x08
|
||||
#define OMPI_EVLIST_INIT 0x80
|
||||
#define OPAL_EVLIST_TIMEOUT 0x01
|
||||
#define OPAL_EVLIST_INSERTED 0x02
|
||||
#define OPAL_EVLIST_SIGNAL 0x04
|
||||
#define OPAL_EVLIST_ACTIVE 0x08
|
||||
#define OPAL_EVLIST_INIT 0x80
|
||||
|
||||
/* EVLIST_X_ Private space: 0x1000-0xf000 */
|
||||
#define OMPI_EVLIST_ALL (0xf000 | 0x8f)
|
||||
#define OPAL_EVLIST_ALL (0xf000 | 0x8f)
|
||||
|
||||
#define OMPI_EV_TIMEOUT 0x01
|
||||
#define OMPI_EV_READ 0x02
|
||||
#define OMPI_EV_WRITE 0x04
|
||||
#define OMPI_EV_SIGNAL 0x08
|
||||
#define OMPI_EV_PERSIST 0x10 /* Persistant event */
|
||||
#define OPAL_EV_TIMEOUT 0x01
|
||||
#define OPAL_EV_READ 0x02
|
||||
#define OPAL_EV_WRITE 0x04
|
||||
#define OPAL_EV_SIGNAL 0x08
|
||||
#define OPAL_EV_PERSIST 0x10 /* Persistant event */
|
||||
|
||||
#ifdef OMPI_EVENT_USE_SIGNALS
|
||||
#undef OMPI_EVENT_USE_SIGNALS
|
||||
#ifdef OPAL_EVENT_USE_SIGNALS
|
||||
#undef OPAL_EVENT_USE_SIGNALS
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
/* 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
|
||||
this mechanism will NOT work under windows
|
||||
*/
|
||||
#define OMPI_EVENT_USE_SIGNALS 0
|
||||
#define OPAL_EVENT_USE_SIGNALS 0
|
||||
#else
|
||||
#define OMPI_EVENT_USE_SIGNALS 1
|
||||
#define OPAL_EVENT_USE_SIGNALS 1
|
||||
#endif
|
||||
|
||||
/* Fix so that ppl dont have to run with <sys/queue.h> */
|
||||
@ -102,11 +102,11 @@ struct { \
|
||||
}
|
||||
#endif /* !RB_ENTRY */
|
||||
|
||||
struct ompi_event {
|
||||
TAILQ_ENTRY (ompi_event) ev_next;
|
||||
TAILQ_ENTRY (ompi_event) ev_active_next;
|
||||
TAILQ_ENTRY (ompi_event) ev_signal_next;
|
||||
RB_ENTRY (ompi_event) ev_timeout_node;
|
||||
struct opal_event {
|
||||
TAILQ_ENTRY (opal_event) ev_next;
|
||||
TAILQ_ENTRY (opal_event) ev_active_next;
|
||||
TAILQ_ENTRY (opal_event) ev_signal_next;
|
||||
RB_ENTRY (opal_event) ev_timeout_node;
|
||||
|
||||
#ifdef WIN32
|
||||
HANDLE ev_fd;
|
||||
@ -126,74 +126,74 @@ struct ompi_event {
|
||||
int ev_res; /* result passed to event callback */
|
||||
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 OMPI_EVENT_FD(ev) (int)ev->ev_fd
|
||||
#define OPAL_EVENT_SIGNAL(ev) (int)ev->ev_fd
|
||||
#define OPAL_EVENT_FD(ev) (int)ev->ev_fd
|
||||
|
||||
#ifdef _EVENT_DEFINED_TQENTRY
|
||||
#undef TAILQ_ENTRY
|
||||
#undef _EVENT_DEFINED_TQENTRY
|
||||
#else
|
||||
TAILQ_HEAD (ompi_event_list, ompi_event);
|
||||
TAILQ_HEAD (opal_event_list, opal_event);
|
||||
#endif /* _EVENT_DEFINED_TQENTRY */
|
||||
#ifdef _EVENT_DEFINED_RBENTRY
|
||||
#undef RB_ENTRY
|
||||
#undef _EVENT_DEFINED_RBENTRY
|
||||
#endif /* _EVENT_DEFINED_RBENTRY */
|
||||
|
||||
struct ompi_eventop {
|
||||
struct opal_eventop {
|
||||
char *name;
|
||||
void *(*init)(void);
|
||||
int (*add)(void *, struct ompi_event *);
|
||||
int (*del)(void *, struct ompi_event *);
|
||||
int (*add)(void *, struct opal_event *);
|
||||
int (*del)(void *, struct opal_event *);
|
||||
int (*recalc)(void *, int);
|
||||
int (*dispatch)(void *, struct timeval *);
|
||||
};
|
||||
|
||||
#define OMPI_TIMEOUT_DEFAULT {1, 0}
|
||||
#define OMPI_EVLOOP_ONCE 0x01
|
||||
#define OMPI_EVLOOP_NONBLOCK 0x02
|
||||
#define OPAL_TIMEOUT_DEFAULT {1, 0}
|
||||
#define OPAL_EVLOOP_ONCE 0x01
|
||||
#define OPAL_EVLOOP_NONBLOCK 0x02
|
||||
|
||||
|
||||
OMPI_DECLSPEC int ompi_event_init(void);
|
||||
OMPI_DECLSPEC int ompi_event_fini(void);
|
||||
OMPI_DECLSPEC int ompi_event_dispatch(void);
|
||||
OMPI_DECLSPEC int ompi_event_loop(int);
|
||||
OMPI_DECLSPEC int ompi_event_enable(void);
|
||||
OMPI_DECLSPEC int ompi_event_disable(void);
|
||||
OMPI_DECLSPEC bool ompi_event_progress_thread(void);
|
||||
OMPI_DECLSPEC int ompi_event_restart(void);
|
||||
OMPI_DECLSPEC int opal_event_init(void);
|
||||
OMPI_DECLSPEC int opal_event_fini(void);
|
||||
OMPI_DECLSPEC int opal_event_dispatch(void);
|
||||
OMPI_DECLSPEC int opal_event_loop(int);
|
||||
OMPI_DECLSPEC int opal_event_enable(void);
|
||||
OMPI_DECLSPEC int opal_event_disable(void);
|
||||
OMPI_DECLSPEC bool opal_event_progress_thread(void);
|
||||
OMPI_DECLSPEC int opal_event_restart(void);
|
||||
|
||||
#define ompi_evtimer_add(ev, tv) ompi_event_add(ev, tv)
|
||||
#define ompi_evtimer_set(ev, cb, arg) ompi_event_set(ev, -1, 0, cb, arg)
|
||||
#define ompi_evtimer_del(ev) ompi_event_del(ev)
|
||||
#define ompi_evtimer_pending(ev, tv) ompi_event_pending(ev, OMPI_EV_TIMEOUT, tv)
|
||||
#define ompi_evtimer_initialized(ev) (ev)->ev_flags & OMPI_EVLIST_INIT)
|
||||
#define opal_evtimer_add(ev, tv) opal_event_add(ev, tv)
|
||||
#define opal_evtimer_set(ev, cb, arg) opal_event_set(ev, -1, 0, cb, arg)
|
||||
#define opal_evtimer_del(ev) opal_event_del(ev)
|
||||
#define opal_evtimer_pending(ev, tv) opal_event_pending(ev, OPAL_EV_TIMEOUT, tv)
|
||||
#define opal_evtimer_initialized(ev) (ev)->ev_flags & OPAL_EVLIST_INIT)
|
||||
|
||||
#define ompi_timeout_add(ev, tv) ompi_event_add(ev, tv)
|
||||
#define ompi_timeout_set(ev, cb, arg) ompi_event_set(ev, -1, 0, cb, arg)
|
||||
#define ompi_timeout_del(ev) ompi_event_del(ev)
|
||||
#define ompi_timeout_pending(ev, tv) ompi_event_pending(ev, OMPI_EV_TIMEOUT, tv)
|
||||
#define ompi_timeout_initialized(ev) ((ev)->ev_flags & OMPI_EVLIST_INIT)
|
||||
#define opal_timeout_add(ev, tv) opal_event_add(ev, tv)
|
||||
#define opal_timeout_set(ev, cb, arg) opal_event_set(ev, -1, 0, cb, arg)
|
||||
#define opal_timeout_del(ev) opal_event_del(ev)
|
||||
#define opal_timeout_pending(ev, tv) opal_event_pending(ev, OPAL_EV_TIMEOUT, tv)
|
||||
#define opal_timeout_initialized(ev) ((ev)->ev_flags & OPAL_EVLIST_INIT)
|
||||
|
||||
#define ompi_signal_add(ev, tv) ompi_event_add(ev, tv)
|
||||
#define ompi_signal_set(ev, x, cb, arg) \
|
||||
ompi_event_set(ev, x, OMPI_EV_SIGNAL|OMPI_EV_PERSIST, cb, arg)
|
||||
#define ompi_signal_del(ev) ompi_event_del(ev)
|
||||
#define ompi_signal_pending(ev, tv) ompi_event_pending(ev, OMPI_EV_SIGNAL, tv)
|
||||
#define ompi_signal_initialized(ev) ((ev)->ev_flags & OMPI_EVLIST_INIT)
|
||||
#define opal_signal_add(ev, tv) opal_event_add(ev, tv)
|
||||
#define opal_signal_set(ev, x, cb, arg) \
|
||||
opal_event_set(ev, x, OPAL_EV_SIGNAL|OPAL_EV_PERSIST, cb, arg)
|
||||
#define opal_signal_del(ev) opal_event_del(ev)
|
||||
#define opal_signal_pending(ev, tv) opal_event_pending(ev, OPAL_EV_SIGNAL, tv)
|
||||
#define opal_signal_initialized(ev) ((ev)->ev_flags & OPAL_EVLIST_INIT)
|
||||
|
||||
/* for internal use only */
|
||||
OMPI_DECLSPEC int ompi_event_add_i(struct ompi_event *, struct timeval *);
|
||||
OMPI_DECLSPEC int ompi_event_del_i(struct ompi_event *);
|
||||
OMPI_DECLSPEC void ompi_event_active_i(struct ompi_event*, int, short);
|
||||
OMPI_DECLSPEC extern opal_mutex_t ompi_event_lock;
|
||||
OMPI_DECLSPEC extern int ompi_evsignal_restart(void);
|
||||
OMPI_DECLSPEC int opal_event_add_i(struct opal_event *, struct timeval *);
|
||||
OMPI_DECLSPEC int opal_event_del_i(struct opal_event *);
|
||||
OMPI_DECLSPEC void opal_event_active_i(struct opal_event*, int, short);
|
||||
OMPI_DECLSPEC extern opal_mutex_t opal_event_lock;
|
||||
OMPI_DECLSPEC extern int opal_evsignal_restart(void);
|
||||
|
||||
/* public functions */
|
||||
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)
|
||||
{
|
||||
ev->ev_callback = callback;
|
||||
@ -205,69 +205,69 @@ ompi_event_set(struct ompi_event *ev, int fd, short events,
|
||||
ev->ev_fd = fd;
|
||||
#endif
|
||||
ev->ev_events = events;
|
||||
ev->ev_flags = OMPI_EVLIST_INIT;
|
||||
ev->ev_flags = OPAL_EVLIST_INIT;
|
||||
ev->ev_ncalls = 0;
|
||||
ev->ev_pncalls = NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
if(opal_using_threads()) {
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
rc = ompi_event_add_i(ev, tv);
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
rc = opal_event_add_i(ev, tv);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
} else {
|
||||
rc = ompi_event_add_i(ev, tv);
|
||||
rc = opal_event_add_i(ev, tv);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
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;
|
||||
if(opal_using_threads()) {
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
rc = ompi_event_del_i(ev);
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
rc = opal_event_del_i(ev);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
} else {
|
||||
rc = ompi_event_del_i(ev);
|
||||
rc = opal_event_del_i(ev);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
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()) {
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
ompi_event_active_i(ev, res, ncalls);
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
opal_event_active_i(ev, res, ncalls);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
} else {
|
||||
ompi_event_active_i(ev, res, ncalls);
|
||||
opal_event_active_i(ev, res, ncalls);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (ev->ev_flags & OMPI_EVLIST_INSERTED)
|
||||
flags |= (ev->ev_events & (OMPI_EV_READ|OMPI_EV_WRITE));
|
||||
if (ev->ev_flags & OMPI_EVLIST_ACTIVE)
|
||||
if (ev->ev_flags & OPAL_EVLIST_INSERTED)
|
||||
flags |= (ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE));
|
||||
if (ev->ev_flags & OPAL_EVLIST_ACTIVE)
|
||||
flags |= ev->ev_res;
|
||||
if (ev->ev_flags & OMPI_EVLIST_TIMEOUT)
|
||||
flags |= OMPI_EV_TIMEOUT;
|
||||
if (ev->ev_flags & OPAL_EVLIST_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 */
|
||||
if (tv != NULL && (flags & event & OMPI_EV_TIMEOUT))
|
||||
if (tv != NULL && (flags & event & OPAL_EV_TIMEOUT))
|
||||
*tv = ev->ev_timeout;
|
||||
|
||||
return (flags & event);
|
||||
@ -275,9 +275,9 @@ ompi_event_pending(struct ompi_event *ev, short event, struct timeval *tv)
|
||||
|
||||
|
||||
#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
|
||||
#define ompi_event_initialized(ev) ((ev)->ev_flags & OMPI_EVLIST_INIT)
|
||||
#define opal_event_initialized(ev) ((ev)->ev_flags & OPAL_EVLIST_INIT)
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
|
@ -27,11 +27,11 @@
|
||||
#ifndef _EVSIGNAL_H_
|
||||
#define _EVSIGNAL_H_
|
||||
|
||||
void ompi_evsignal_init(sigset_t *);
|
||||
void ompi_evsignal_process(void);
|
||||
int ompi_evsignal_recalc(sigset_t *);
|
||||
int ompi_evsignal_deliver(sigset_t *);
|
||||
int ompi_evsignal_add(sigset_t *, struct ompi_event *);
|
||||
int ompi_evsignal_del(sigset_t *, struct ompi_event *);
|
||||
void opal_evsignal_init(sigset_t *);
|
||||
void opal_evsignal_process(void);
|
||||
int opal_evsignal_recalc(sigset_t *);
|
||||
int opal_evsignal_deliver(sigset_t *);
|
||||
int opal_evsignal_add(sigset_t *, struct opal_event *);
|
||||
int opal_evsignal_del(sigset_t *, struct opal_event *);
|
||||
|
||||
#endif /* _EVSIGNAL_H_ */
|
||||
|
@ -70,7 +70,7 @@
|
||||
extern struct event_list timequeue;
|
||||
extern struct event_list eventqueue;
|
||||
extern struct event_list addqueue;
|
||||
extern opal_mutex_t ompi_event_lock;
|
||||
extern opal_mutex_t opal_event_lock;
|
||||
|
||||
#define EVLIST_X_KQINKERNEL 0x1000
|
||||
|
||||
@ -85,13 +85,13 @@ struct kqop {
|
||||
} kqueueop;
|
||||
|
||||
static void *kq_init (void);
|
||||
static int kq_add (void *, struct ompi_event *);
|
||||
static int kq_del (void *, struct ompi_event *);
|
||||
static int kq_add (void *, struct opal_event *);
|
||||
static int kq_del (void *, struct opal_event *);
|
||||
static int kq_recalc (void *, int);
|
||||
static int kq_dispatch (void *, struct timeval *);
|
||||
static int kq_insert (struct kqop *, struct kevent *);
|
||||
|
||||
const struct ompi_eventop ompi_kqops = {
|
||||
const struct opal_eventop opal_kqops = {
|
||||
"kqueue",
|
||||
kq_init,
|
||||
kq_add,
|
||||
@ -197,7 +197,7 @@ kq_dispatch(void *arg, struct timeval *tv)
|
||||
struct kqop *kqop = arg;
|
||||
struct kevent *changes = kqop->changes;
|
||||
struct kevent *events = kqop->events;
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
struct timespec ts;
|
||||
int i, res;
|
||||
|
||||
@ -205,10 +205,10 @@ kq_dispatch(void *arg, struct timeval *tv)
|
||||
|
||||
/* release lock while waiting in kernel */
|
||||
if(opal_using_threads()) {
|
||||
opal_mutex_unlock(&ompi_event_lock);
|
||||
opal_mutex_unlock(&opal_event_lock);
|
||||
res = kevent(kqop->kq, changes, kqop->nchanges,
|
||||
events, kqop->nevents, &ts);
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
} else {
|
||||
res = kevent(kqop->kq, changes, kqop->nchanges,
|
||||
events, kqop->nevents, &ts);
|
||||
@ -246,26 +246,26 @@ kq_dispatch(void *arg, struct timeval *tv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ev = (struct ompi_event *)events[i].udata;
|
||||
ev = (struct opal_event *)events[i].udata;
|
||||
|
||||
if (events[i].filter == EVFILT_READ) {
|
||||
which |= OMPI_EV_READ;
|
||||
which |= OPAL_EV_READ;
|
||||
} else if (events[i].filter == EVFILT_WRITE) {
|
||||
which |= OMPI_EV_WRITE;
|
||||
which |= OPAL_EV_WRITE;
|
||||
} else if (events[i].filter == EVFILT_SIGNAL) {
|
||||
which |= OMPI_EV_SIGNAL;
|
||||
which |= OPAL_EV_SIGNAL;
|
||||
}
|
||||
|
||||
if (!which)
|
||||
continue;
|
||||
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST)) {
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST)) {
|
||||
ev->ev_flags &= ~EVLIST_X_KQINKERNEL;
|
||||
ompi_event_del_i(ev);
|
||||
opal_event_del_i(ev);
|
||||
}
|
||||
|
||||
ompi_event_active_i(ev, which,
|
||||
ev->ev_events & OMPI_EV_SIGNAL ? events[i].data : 1);
|
||||
opal_event_active_i(ev, which,
|
||||
ev->ev_events & OPAL_EV_SIGNAL ? events[i].data : 1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -273,19 +273,19 @@ kq_dispatch(void *arg, struct timeval *tv)
|
||||
|
||||
|
||||
static int
|
||||
kq_add(void *arg, struct ompi_event *ev)
|
||||
kq_add(void *arg, struct opal_event *ev)
|
||||
{
|
||||
struct kqop *kqop = arg;
|
||||
struct kevent kev;
|
||||
|
||||
if (ev->ev_events & OMPI_EV_SIGNAL) {
|
||||
int nsignal = OMPI_EVENT_SIGNAL(ev);
|
||||
if (ev->ev_events & OPAL_EV_SIGNAL) {
|
||||
int nsignal = OPAL_EVENT_SIGNAL(ev);
|
||||
|
||||
memset(&kev, 0, sizeof(kev));
|
||||
kev.ident = nsignal;
|
||||
kev.filter = EVFILT_SIGNAL;
|
||||
kev.flags = EV_ADD;
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
kev.flags |= EV_ONESHOT;
|
||||
kev.udata = (void *) INTPTR(ev);
|
||||
|
||||
@ -299,12 +299,12 @@ kq_add(void *arg, struct ompi_event *ev)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (ev->ev_events & OMPI_EV_READ) {
|
||||
if (ev->ev_events & OPAL_EV_READ) {
|
||||
memset(&kev, 0, sizeof(kev));
|
||||
kev.ident = ev->ev_fd;
|
||||
kev.filter = EVFILT_READ;
|
||||
kev.flags = EV_ADD;
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
kev.flags |= EV_ONESHOT;
|
||||
kev.udata = (void *) INTPTR(ev);
|
||||
|
||||
@ -314,12 +314,12 @@ kq_add(void *arg, struct ompi_event *ev)
|
||||
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));
|
||||
kev.ident = ev->ev_fd;
|
||||
kev.filter = EVFILT_WRITE;
|
||||
kev.flags = EV_ADD;
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
kev.flags |= EV_ONESHOT;
|
||||
kev.udata = (void *) INTPTR(ev);
|
||||
|
||||
@ -333,7 +333,7 @@ kq_add(void *arg, struct ompi_event *ev)
|
||||
}
|
||||
|
||||
static int
|
||||
kq_del(void *arg, struct ompi_event *ev)
|
||||
kq_del(void *arg, struct opal_event *ev)
|
||||
{
|
||||
struct kqop *kqop = arg;
|
||||
struct kevent kev;
|
||||
@ -341,8 +341,8 @@ kq_del(void *arg, struct ompi_event *ev)
|
||||
if (!(ev->ev_flags & EVLIST_X_KQINKERNEL))
|
||||
return (0);
|
||||
|
||||
if (ev->ev_events & OMPI_EV_SIGNAL) {
|
||||
int nsignal = OMPI_EVENT_SIGNAL(ev);
|
||||
if (ev->ev_events & OPAL_EV_SIGNAL) {
|
||||
int nsignal = OPAL_EVENT_SIGNAL(ev);
|
||||
|
||||
memset(&kev, 0, sizeof(kev));
|
||||
kev.ident = (int)signal;
|
||||
@ -359,7 +359,7 @@ kq_del(void *arg, struct ompi_event *ev)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (ev->ev_events & OMPI_EV_READ) {
|
||||
if (ev->ev_events & OPAL_EV_READ) {
|
||||
memset(&kev, 0, sizeof(kev));
|
||||
kev.ident = ev->ev_fd;
|
||||
kev.filter = EVFILT_READ;
|
||||
@ -371,7 +371,7 @@ kq_del(void *arg, struct ompi_event *ev)
|
||||
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));
|
||||
kev.ident = ev->ev_fd;
|
||||
kev.filter = EVFILT_WRITE;
|
||||
|
@ -59,29 +59,29 @@
|
||||
|
||||
#include "event.h"
|
||||
#include "util/output.h"
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
#include "evsignal.h"
|
||||
#endif
|
||||
#include "opal/threads/mutex.h"
|
||||
|
||||
|
||||
extern struct ompi_event_list ompi_eventqueue;
|
||||
extern volatile sig_atomic_t ompi_evsignal_caught;
|
||||
extern opal_mutex_t ompi_event_lock;
|
||||
extern struct opal_event_list opal_eventqueue;
|
||||
extern volatile sig_atomic_t opal_evsignal_caught;
|
||||
extern opal_mutex_t opal_event_lock;
|
||||
|
||||
/* Open MPI: make this struct instance be static */
|
||||
static struct pollop {
|
||||
int event_count; /* Highest number alloc */
|
||||
struct pollfd *event_set;
|
||||
struct ompi_event **event_back;
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
struct opal_event **event_back;
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
sigset_t evsigmask;
|
||||
#endif
|
||||
} pollop;
|
||||
|
||||
static void *poll_init (void);
|
||||
static int poll_add (void *, struct ompi_event *);
|
||||
static int poll_del (void *, struct ompi_event *);
|
||||
static int poll_add (void *, struct opal_event *);
|
||||
static int poll_del (void *, struct opal_event *);
|
||||
#if 0
|
||||
/* Open MPI: JMS As far as I can tell, this function is not used
|
||||
anywhere */
|
||||
@ -89,7 +89,7 @@ static int poll_recalc (void *, int);
|
||||
#endif
|
||||
static int poll_dispatch (void *, struct timeval *);
|
||||
|
||||
const struct ompi_eventop ompi_pollops = {
|
||||
const struct opal_eventop opal_pollops = {
|
||||
"poll",
|
||||
poll_init,
|
||||
poll_add,
|
||||
@ -106,8 +106,8 @@ poll_init(void)
|
||||
return (NULL);
|
||||
|
||||
memset(&pollop, 0, sizeof(pollop));
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
ompi_evsignal_init(&pollop.evsigmask);
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
opal_evsignal_init(&pollop.evsigmask);
|
||||
#endif
|
||||
return (&pollop);
|
||||
}
|
||||
@ -123,9 +123,9 @@ poll_init(void)
|
||||
static int
|
||||
poll_recalc(void *arg, int max)
|
||||
{
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
struct pollop *pop = arg;
|
||||
return (ompi_evsignal_recalc(&pop->evsigmask));
|
||||
return (opal_evsignal_recalc(&pop->evsigmask));
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
@ -136,12 +136,12 @@ static int
|
||||
poll_dispatch(void *arg, struct timeval *tv)
|
||||
{
|
||||
int res, i, count, sec, nfds;
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
struct pollop *pop = arg;
|
||||
|
||||
count = pop->event_count;
|
||||
nfds = 0;
|
||||
TAILQ_FOREACH(ev, &ompi_eventqueue, ev_next) {
|
||||
TAILQ_FOREACH(ev, &opal_eventqueue, ev_next) {
|
||||
if (nfds + 1 >= count) {
|
||||
if (count < 256)
|
||||
count = 256;
|
||||
@ -156,14 +156,14 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
return (-1);
|
||||
}
|
||||
pop->event_back = realloc(pop->event_back,
|
||||
count * sizeof(struct ompi_event *));
|
||||
count * sizeof(struct opal_event *));
|
||||
if (pop->event_back == NULL) {
|
||||
log_error("realloc");
|
||||
return (-1);
|
||||
}
|
||||
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];
|
||||
pfd->fd = ev->ev_fd;
|
||||
pfd->events = POLLOUT;
|
||||
@ -173,7 +173,7 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
|
||||
nfds++;
|
||||
}
|
||||
if (ev->ev_events & OMPI_EV_READ) {
|
||||
if (ev->ev_events & OPAL_EV_READ) {
|
||||
struct pollfd *pfd = &pop->event_set[nfds];
|
||||
|
||||
pfd->fd = ev->ev_fd;
|
||||
@ -186,18 +186,18 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
}
|
||||
}
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
if (ompi_evsignal_deliver(&pop->evsigmask) == -1)
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
if (opal_evsignal_deliver(&pop->evsigmask) == -1)
|
||||
return (-1);
|
||||
#endif
|
||||
|
||||
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);
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
if (ompi_evsignal_recalc(&pop->evsigmask) == -1)
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
if (opal_evsignal_recalc(&pop->evsigmask) == -1)
|
||||
return (-1);
|
||||
#endif
|
||||
|
||||
@ -207,15 +207,15 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
ompi_evsignal_process();
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
opal_evsignal_process();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
else if (ompi_evsignal_caught)
|
||||
ompi_evsignal_process();
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
else if (opal_evsignal_caught)
|
||||
opal_evsignal_process();
|
||||
#endif
|
||||
|
||||
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))
|
||||
what |= POLLIN|POLLOUT;
|
||||
if (what & POLLIN)
|
||||
res |= OMPI_EV_READ;
|
||||
res |= OPAL_EV_READ;
|
||||
if (what & POLLOUT)
|
||||
res |= OMPI_EV_WRITE;
|
||||
res |= OPAL_EV_WRITE;
|
||||
if (res == 0)
|
||||
continue;
|
||||
|
||||
@ -242,9 +242,9 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
res &= ev->ev_events;
|
||||
|
||||
if (res) {
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
ompi_event_del_i(ev);
|
||||
ompi_event_active_i(ev, res, 1);
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
opal_event_del_i(ev);
|
||||
opal_event_active_i(ev, res, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,12 +252,12 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
}
|
||||
|
||||
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;
|
||||
if (ev->ev_events & OMPI_EV_SIGNAL)
|
||||
return (ompi_evsignal_add(&pop->evsigmask, ev));
|
||||
if (ev->ev_events & OPAL_EV_SIGNAL)
|
||||
return (opal_evsignal_add(&pop->evsigmask, ev));
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
@ -267,15 +267,15 @@ poll_add(void *arg, struct ompi_event *ev)
|
||||
*/
|
||||
|
||||
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;
|
||||
#endif
|
||||
if (!(ev->ev_events & OMPI_EV_SIGNAL))
|
||||
if (!(ev->ev_events & OPAL_EV_SIGNAL))
|
||||
return (0);
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
return (ompi_evsignal_del(&pop->evsigmask, ev));
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
return (opal_evsignal_del(&pop->evsigmask, ev));
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
|
@ -127,7 +127,7 @@ static int rtsig_del(void *, struct event *);
|
||||
static int rtsig_recalc(void *, int);
|
||||
static int rtsig_dispatch(void *, struct timeval *);
|
||||
|
||||
struct ompi_eventop rtsigops = {
|
||||
struct opal_eventop rtsigops = {
|
||||
"rtsig",
|
||||
rtsig_init,
|
||||
rtsig_add,
|
||||
|
@ -33,13 +33,13 @@ fifo_read(int fd, short event, void *arg)
|
||||
{
|
||||
char buf[255];
|
||||
int len;
|
||||
struct ompi_event *ev = arg;
|
||||
struct opal_event *ev = arg;
|
||||
#ifdef WIN32
|
||||
DWORD dwBytesRead;
|
||||
#endif
|
||||
|
||||
/* 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",
|
||||
fd, event, arg);
|
||||
@ -49,7 +49,7 @@ fifo_read(int fd, short event, void *arg)
|
||||
// Check for end of file.
|
||||
if(len && dwBytesRead == 0) {
|
||||
fprintf(stderr, "End Of File");
|
||||
ompi_event_del(ev);
|
||||
opal_event_del(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ fifo_read(int fd, short event, void *arg)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct ompi_event evfifo;
|
||||
struct opal_event evfifo;
|
||||
#ifdef WIN32
|
||||
HANDLE socket;
|
||||
// Open a file.
|
||||
@ -122,19 +122,19 @@ main (int argc, char **argv)
|
||||
fprintf(stderr, "Write data to %s\n", fifo);
|
||||
#endif
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
/* Initalize one event */
|
||||
#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
|
||||
ompi_event_set(&evfifo, socket, OMPI_EV_READ, fifo_read, &evfifo);
|
||||
opal_event_set(&evfifo, socket, OPAL_EV_READ, fifo_read, &evfifo);
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
CloseHandle(socket);
|
||||
#endif
|
||||
|
@ -34,12 +34,12 @@ int called = 0;
|
||||
void
|
||||
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)
|
||||
ompi_event_del(signal);
|
||||
opal_event_del(signal);
|
||||
|
||||
called++;
|
||||
}
|
||||
@ -47,18 +47,18 @@ signal_cb(int fd, short event, void *arg)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct ompi_event signal_int;
|
||||
struct opal_event signal_int;
|
||||
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
/* 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);
|
||||
|
||||
ompi_event_add(&signal_int, NULL);
|
||||
opal_event_add(&signal_int, NULL);
|
||||
|
||||
ompi_event_dispatch();
|
||||
opal_event_dispatch();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ void
|
||||
timeout_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct ompi_event *timeout = arg;
|
||||
struct opal_event *timeout = arg;
|
||||
int newtime = time(NULL);
|
||||
|
||||
printf("%s: called at %d: %d\n", __func__, newtime,
|
||||
@ -43,28 +43,28 @@ timeout_cb(int fd, short event, void *arg)
|
||||
|
||||
timerclear(&tv);
|
||||
tv.tv_sec = 2;
|
||||
ompi_event_add(timeout, &tv);
|
||||
opal_event_add(timeout, &tv);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct ompi_event timeout;
|
||||
struct opal_event timeout;
|
||||
struct timeval tv;
|
||||
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
/* Initalize one event */
|
||||
ompi_evtimer_set(&timeout, timeout_cb, &timeout);
|
||||
opal_evtimer_set(&timeout, timeout_cb, &timeout);
|
||||
|
||||
timerclear(&tv);
|
||||
tv.tv_sec = 2;
|
||||
ompi_event_add(&timeout, &tv);
|
||||
opal_event_add(&timeout, &tv);
|
||||
|
||||
lasttime = time(NULL);
|
||||
|
||||
ompi_event_dispatch();
|
||||
opal_event_dispatch();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -57,20 +57,20 @@
|
||||
#endif
|
||||
|
||||
#include "event.h"
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
#include "evsignal.h"
|
||||
#endif
|
||||
#include "opal/threads/mutex.h"
|
||||
|
||||
extern struct ompi_event_list ompi_eventqueue;
|
||||
extern opal_mutex_t ompi_event_lock;
|
||||
extern struct opal_event_list opal_eventqueue;
|
||||
extern opal_mutex_t opal_event_lock;
|
||||
|
||||
#ifndef howmany
|
||||
#define howmany(x, y) (((x)+((y)-1))/(y))
|
||||
#endif
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
extern volatile sig_atomic_t ompi_evsignal_caught;
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
extern volatile sig_atomic_t opal_evsignal_caught;
|
||||
#endif
|
||||
|
||||
static struct selectop {
|
||||
@ -78,18 +78,18 @@ static struct selectop {
|
||||
int event_fdsz;
|
||||
fd_set *event_readset;
|
||||
fd_set *event_writeset;
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
sigset_t evsigmask;
|
||||
#endif
|
||||
} sop;
|
||||
|
||||
static void *select_init (void);
|
||||
static int select_add (void *, struct ompi_event *);
|
||||
static int select_del (void *, struct ompi_event *);
|
||||
static int select_add (void *, struct opal_event *);
|
||||
static int select_del (void *, struct opal_event *);
|
||||
static int select_recalc (void *, int);
|
||||
static int select_dispatch (void *, struct timeval *);
|
||||
|
||||
const struct ompi_eventop ompi_selectops = {
|
||||
const struct opal_eventop opal_selectops = {
|
||||
"select",
|
||||
select_init,
|
||||
select_add,
|
||||
@ -115,8 +115,8 @@ select_init(void)
|
||||
sop.event_readset = malloc (sizeof(fd_set));
|
||||
sop.event_writeset = malloc (sizeof(fd_set));
|
||||
#endif
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
ompi_evsignal_init(&sop.evsigmask);
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
opal_evsignal_init(&sop.evsigmask);
|
||||
#endif
|
||||
return (&sop);
|
||||
}
|
||||
@ -132,14 +132,14 @@ select_recalc(void *arg, int max)
|
||||
{
|
||||
struct selectop *sop = arg;
|
||||
fd_set *readset, *writeset;
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
int fdsz;
|
||||
|
||||
if (sop->event_fds < max)
|
||||
sop->event_fds = max;
|
||||
|
||||
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)
|
||||
sop->event_fds = ev->ev_fd;
|
||||
}
|
||||
@ -166,8 +166,8 @@ select_recalc(void *arg, int max)
|
||||
sop->event_writeset = writeset;
|
||||
sop->event_fdsz = fdsz;
|
||||
}
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
return (ompi_evsignal_recalc(&sop->evsigmask));
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
return (opal_evsignal_recalc(&sop->evsigmask));
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
@ -178,7 +178,7 @@ static int
|
||||
select_dispatch(void *arg, struct timeval *tv)
|
||||
{
|
||||
int maxfd, res;
|
||||
struct ompi_event *ev, *next;
|
||||
struct opal_event *ev, *next;
|
||||
struct selectop *sop = arg;
|
||||
|
||||
#ifndef WIN32
|
||||
@ -186,26 +186,26 @@ select_dispatch(void *arg, struct timeval *tv)
|
||||
memset(sop->event_writeset, 0, sop->event_fdsz);
|
||||
#endif
|
||||
|
||||
TAILQ_FOREACH(ev, &ompi_eventqueue, ev_next) {
|
||||
if (ev->ev_events & OMPI_EV_WRITE)
|
||||
TAILQ_FOREACH(ev, &opal_eventqueue, ev_next) {
|
||||
if (ev->ev_events & OPAL_EV_WRITE)
|
||||
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);
|
||||
}
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
if (ompi_evsignal_deliver(&sop->evsigmask) == -1)
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
if (opal_evsignal_deliver(&sop->evsigmask) == -1)
|
||||
return (-1);
|
||||
#endif
|
||||
|
||||
/* 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,
|
||||
sop->event_writeset, NULL, tv);
|
||||
opal_mutex_lock(&ompi_event_lock);
|
||||
opal_mutex_lock(&opal_event_lock);
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
if (ompi_evsignal_recalc(&sop->evsigmask) == -1)
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
if (opal_evsignal_recalc(&sop->evsigmask) == -1)
|
||||
return (-1);
|
||||
#endif
|
||||
|
||||
@ -214,22 +214,22 @@ select_dispatch(void *arg, struct timeval *tv)
|
||||
/* poll each of the file descriptors individually to determine
|
||||
* 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);
|
||||
|
||||
tv->tv_sec = 0;
|
||||
tv->tv_usec = 0;
|
||||
memset(sop->event_readset, 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);
|
||||
if (ev->ev_events & OMPI_EV_READ)
|
||||
if (ev->ev_events & OPAL_EV_READ)
|
||||
FD_SET(ev->ev_fd, sop->event_readset);
|
||||
res = select(sop->event_fds + 1, sop->event_readset,
|
||||
sop->event_writeset, NULL, tv);
|
||||
if(res < 0) {
|
||||
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);
|
||||
}
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
ompi_evsignal_process();
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
opal_evsignal_process();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
else if (ompi_evsignal_caught)
|
||||
ompi_evsignal_process();
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
else if (opal_evsignal_caught)
|
||||
opal_evsignal_process();
|
||||
#endif
|
||||
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);
|
||||
|
||||
res = 0;
|
||||
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))
|
||||
res |= OMPI_EV_WRITE;
|
||||
res |= OPAL_EV_WRITE;
|
||||
res &= ev->ev_events;
|
||||
|
||||
if (res) {
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
ompi_event_del_i(ev);
|
||||
ompi_event_active_i(ev, res, 1);
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
opal_event_del_i(ev);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -272,13 +272,13 @@ select_dispatch(void *arg, struct timeval *tv)
|
||||
}
|
||||
|
||||
static int
|
||||
select_add(void *arg, struct ompi_event *ev)
|
||||
select_add(void *arg, struct opal_event *ev)
|
||||
{
|
||||
struct selectop *sop = arg;
|
||||
|
||||
#if OMPI_EVENT_USE_SIGNALS
|
||||
if (ev->ev_events & OMPI_EV_SIGNAL)
|
||||
return (ompi_evsignal_add(&sop->evsigmask, ev));
|
||||
#if OPAL_EVENT_USE_SIGNALS
|
||||
if (ev->ev_events & OPAL_EV_SIGNAL)
|
||||
return (opal_evsignal_add(&sop->evsigmask, ev));
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -296,15 +296,15 @@ select_add(void *arg, struct ompi_event *ev)
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
if (!(ev->ev_events & OMPI_EV_SIGNAL))
|
||||
if (!(ev->ev_events & OPAL_EV_SIGNAL))
|
||||
return (0);
|
||||
|
||||
return (ompi_evsignal_del(&sop->evsigmask, ev));
|
||||
return (opal_evsignal_del(&sop->evsigmask, ev));
|
||||
#else
|
||||
return (0);
|
||||
#endif
|
||||
|
@ -59,33 +59,33 @@
|
||||
#include "evsignal.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 int ompi_needrecalc;
|
||||
static short opal_evsigcaught[NSIG];
|
||||
static int opal_needrecalc;
|
||||
#if 0
|
||||
static int ompi_event_signal_pipe[2];
|
||||
static ompi_event_t ompi_event_signal_pipe_event;
|
||||
static int opal_event_signal_pipe[2];
|
||||
static opal_event_t opal_event_signal_pipe_event;
|
||||
#endif
|
||||
volatile sig_atomic_t ompi_event_signal_count = 0;
|
||||
volatile sig_atomic_t opal_event_signal_count = 0;
|
||||
static bool initialized = false;
|
||||
volatile sig_atomic_t ompi_evsignal_caught = 0;
|
||||
volatile sig_atomic_t opal_evsignal_caught = 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);
|
||||
while(ompi_event_signal_count-- > 0) {
|
||||
ompi_output(0, "opal_event_signal_pipe_handler: %d\n", opal_event_signal_count);
|
||||
while(opal_event_signal_count-- > 0) {
|
||||
char byte;
|
||||
read(ompi_event_signal_pipe[0], &byte, 1);
|
||||
read(opal_event_signal_pipe[0], &byte, 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ompi_evsignal_handler(int sig);
|
||||
void opal_evsignal_handler(int sig);
|
||||
|
||||
void
|
||||
ompi_evsignal_init(sigset_t *evsigmask)
|
||||
opal_evsignal_init(sigset_t *evsigmask)
|
||||
{
|
||||
#ifndef WIN32
|
||||
sigemptyset(evsigmask);
|
||||
@ -94,35 +94,35 @@ ompi_evsignal_init(sigset_t *evsigmask)
|
||||
|
||||
|
||||
int
|
||||
ompi_evsignal_add(sigset_t *evsigmask, struct ompi_event *ev)
|
||||
opal_evsignal_add(sigset_t *evsigmask, struct opal_event *ev)
|
||||
{
|
||||
int evsignal;
|
||||
|
||||
if (!initialized) {
|
||||
ompi_event_signal_count = 0;
|
||||
opal_event_signal_count = 0;
|
||||
#if 0
|
||||
/* Must delay the event add until after init() because
|
||||
it may trigger poll events that are not yet setup
|
||||
to be triggered. */
|
||||
pipe(ompi_event_signal_pipe);
|
||||
ompi_event_set(&ompi_event_signal_pipe_event,
|
||||
ompi_event_signal_pipe[0],
|
||||
OMPI_EV_READ|OMPI_EV_PERSIST,
|
||||
ompi_event_signal_pipe_handler,
|
||||
pipe(opal_event_signal_pipe);
|
||||
opal_event_set(&opal_event_signal_pipe_event,
|
||||
opal_event_signal_pipe[0],
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
opal_event_signal_pipe_handler,
|
||||
0);
|
||||
ompi_event_add_i(&ompi_event_signal_pipe_event, 0);
|
||||
opal_event_add_i(&opal_event_signal_pipe_event, 0);
|
||||
#endif
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
if (ev->ev_events & (OMPI_EV_READ|OMPI_EV_WRITE))
|
||||
errx(1, "%s: OMPI_EV_SIGNAL incompatible use", __func__);
|
||||
evsignal = OMPI_EVENT_SIGNAL(ev);
|
||||
if (ev->ev_events & (OPAL_EV_READ|OPAL_EV_WRITE))
|
||||
errx(1, "%s: OPAL_EV_SIGNAL incompatible use", __func__);
|
||||
evsignal = OPAL_EVENT_SIGNAL(ev);
|
||||
|
||||
#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
|
||||
ompi_event_loop(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
@ -132,22 +132,22 @@ ompi_evsignal_add(sigset_t *evsigmask, struct ompi_event *ev)
|
||||
}
|
||||
|
||||
int
|
||||
ompi_evsignal_restart(void)
|
||||
opal_evsignal_restart(void)
|
||||
{
|
||||
if(initialized) {
|
||||
ompi_event_signal_count = 0;
|
||||
opal_event_signal_count = 0;
|
||||
#if 0
|
||||
int rc;
|
||||
ompi_event_del_i(&ompi_event_signal_pipe_event);
|
||||
if ((rc = pipe(ompi_event_signal_pipe)) != 0) {
|
||||
opal_event_del_i(&opal_event_signal_pipe_event);
|
||||
if ((rc = pipe(opal_event_signal_pipe)) != 0) {
|
||||
return rc;
|
||||
}
|
||||
ompi_event_set(&ompi_event_signal_pipe_event,
|
||||
ompi_event_signal_pipe[0],
|
||||
OMPI_EV_READ|OMPI_EV_PERSIST,
|
||||
ompi_event_signal_pipe_handler,
|
||||
opal_event_set(&opal_event_signal_pipe_event,
|
||||
opal_event_signal_pipe[0],
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
opal_event_signal_pipe_handler,
|
||||
0);
|
||||
ompi_event_add_i(&ompi_event_signal_pipe_event, 0);
|
||||
opal_event_add_i(&opal_event_signal_pipe_event, 0);
|
||||
#endif
|
||||
}
|
||||
return (0);
|
||||
@ -158,7 +158,7 @@ ompi_evsignal_restart(void)
|
||||
*/
|
||||
|
||||
int
|
||||
ompi_evsignal_del(sigset_t *evsigmask, struct ompi_event *ev)
|
||||
opal_evsignal_del(sigset_t *evsigmask, struct opal_event *ev)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return 0;
|
||||
@ -166,9 +166,9 @@ ompi_evsignal_del(sigset_t *evsigmask, struct ompi_event *ev)
|
||||
int evsignal;
|
||||
struct sigaction sa;
|
||||
|
||||
evsignal = OMPI_EVENT_SIGNAL(ev);
|
||||
evsignal = OPAL_EVENT_SIGNAL(ev);
|
||||
sigdelset(evsigmask, evsignal);
|
||||
ompi_needrecalc = 1;
|
||||
opal_needrecalc = 1;
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = SIG_DFL;
|
||||
@ -178,49 +178,49 @@ ompi_evsignal_del(sigset_t *evsigmask, struct ompi_event *ev)
|
||||
}
|
||||
|
||||
void
|
||||
ompi_evsignal_handler(int sig)
|
||||
opal_evsignal_handler(int sig)
|
||||
{
|
||||
#if 0
|
||||
unsigned char byte = 0;
|
||||
#endif
|
||||
|
||||
ompi_evsigcaught[sig]++;
|
||||
ompi_evsignal_caught = 1;
|
||||
opal_evsigcaught[sig]++;
|
||||
opal_evsignal_caught = 1;
|
||||
|
||||
#if 0
|
||||
if(ompi_event_signal_count == 0) {
|
||||
ompi_event_signal_count++;
|
||||
write(ompi_event_signal_pipe[1], &byte, 1);
|
||||
if(opal_event_signal_count == 0) {
|
||||
opal_event_signal_count++;
|
||||
write(opal_event_signal_pipe[1], &byte, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
ompi_evsignal_recalc(sigset_t *evsigmask)
|
||||
opal_evsignal_recalc(sigset_t *evsigmask)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return 0;
|
||||
#else
|
||||
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);
|
||||
ompi_needrecalc = 0;
|
||||
opal_needrecalc = 0;
|
||||
|
||||
if (sigprocmask(SIG_BLOCK, evsigmask, NULL) == -1)
|
||||
return (-1);
|
||||
|
||||
/* Reinstall our signal handler. */
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = ompi_evsignal_handler;
|
||||
sa.sa_handler = opal_evsignal_handler;
|
||||
sa.sa_mask = *evsigmask;
|
||||
#if OMPI_HAVE_SA_RESTART
|
||||
sa.sa_flags |= SA_RESTART;
|
||||
#endif
|
||||
|
||||
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) {
|
||||
if (sigaction(OMPI_EVENT_SIGNAL(ev), &sa, NULL) == -1)
|
||||
TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
|
||||
if (sigaction(OPAL_EVENT_SIGNAL(ev), &sa, NULL) == -1)
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
@ -228,9 +228,9 @@ ompi_evsignal_recalc(sigset_t *evsigmask)
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
#ifdef WIN32
|
||||
@ -242,21 +242,21 @@ ompi_evsignal_deliver(sigset_t *evsigmask)
|
||||
}
|
||||
|
||||
void
|
||||
ompi_evsignal_process(void)
|
||||
opal_evsignal_process(void)
|
||||
{
|
||||
struct ompi_event *ev;
|
||||
struct opal_event *ev;
|
||||
short ncalls;
|
||||
|
||||
TAILQ_FOREACH(ev, &ompi_signalqueue, ev_signal_next) {
|
||||
ncalls = ompi_evsigcaught[OMPI_EVENT_SIGNAL(ev)];
|
||||
TAILQ_FOREACH(ev, &opal_signalqueue, ev_signal_next) {
|
||||
ncalls = opal_evsigcaught[OPAL_EVENT_SIGNAL(ev)];
|
||||
if (ncalls) {
|
||||
if (!(ev->ev_events & OMPI_EV_PERSIST))
|
||||
ompi_event_del_i(ev);
|
||||
ompi_event_active_i(ev, OMPI_EV_SIGNAL, ncalls);
|
||||
if (!(ev->ev_events & OPAL_EV_PERSIST))
|
||||
opal_event_del_i(ev);
|
||||
opal_event_active_i(ev, OPAL_EV_SIGNAL, ncalls);
|
||||
}
|
||||
}
|
||||
|
||||
memset(ompi_evsigcaught, 0, sizeof(ompi_evsigcaught));
|
||||
ompi_evsignal_caught = 0;
|
||||
memset(opal_evsigcaught, 0, sizeof(opal_evsigcaught));
|
||||
opal_evsignal_caught = 0;
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* 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
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWLAM_EVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (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>
|
||||
@ -66,7 +66,7 @@
|
||||
static int count, writes, fired;
|
||||
static int *pipes;
|
||||
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;
|
||||
|
||||
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
|
||||
ompi_event_del(&events[i]);
|
||||
ompi_event_set(&events[i], cp[0], OMPI_EV_READ | OMPI_EV_PERSIST, read_cb, (void *) i);
|
||||
ompi_event_add(&events[i], NULL);
|
||||
opal_event_del(&events[i]);
|
||||
opal_event_set(&events[i], cp[0], OPAL_EV_READ | OPAL_EV_PERSIST, read_cb, (void *) i);
|
||||
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;
|
||||
space = num_pipes / num_active;
|
||||
@ -111,7 +111,7 @@ run_once(void)
|
||||
{ int xcount = 0;
|
||||
gettimeofday(&ts, NULL);
|
||||
do {
|
||||
ompi_event_loop(OMPI_EVLOOP_ONCE | OMPI_EVLOOP_NONBLOCK);
|
||||
opal_event_loop(OPAL_EVLOOP_ONCE | OPAL_EVLOOP_NONBLOCK);
|
||||
xcount++;
|
||||
} while (count != fired);
|
||||
gettimeofday(&te, NULL);
|
||||
@ -159,14 +159,14 @@ main (int argc, char **argv)
|
||||
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));
|
||||
if (events == NULL || pipes == NULL) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
|
||||
#ifdef USE_PIPES
|
||||
|
@ -75,7 +75,7 @@ simple_read_cb(int fd, short event, void *arg)
|
||||
|
||||
if (len) {
|
||||
if (!called)
|
||||
ompi_event_add(arg, NULL);
|
||||
opal_event_add(arg, NULL);
|
||||
} else if (called == 1)
|
||||
test_ok = 1;
|
||||
|
||||
@ -97,7 +97,7 @@ simple_write_cb(int fd, short event, void *arg)
|
||||
void
|
||||
multiple_write_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct ompi_event *ev = arg;
|
||||
struct opal_event *ev = arg;
|
||||
int len;
|
||||
|
||||
len = 128;
|
||||
@ -108,7 +108,7 @@ multiple_write_cb(int fd, short event, void *arg)
|
||||
if (len == -1) {
|
||||
fprintf(stderr, "%s: write\n", __func__);
|
||||
if (usepersist)
|
||||
ompi_event_del(ev);
|
||||
opal_event_del(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -117,18 +117,18 @@ multiple_write_cb(int fd, short event, void *arg)
|
||||
if (woff >= sizeof(wbuf)) {
|
||||
shutdown(fd, SHUT_WR);
|
||||
if (usepersist)
|
||||
ompi_event_del(ev);
|
||||
opal_event_del(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!usepersist)
|
||||
ompi_event_add(ev, NULL);
|
||||
opal_event_add(ev, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
multiple_read_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct ompi_event *ev = arg;
|
||||
struct opal_event *ev = arg;
|
||||
int len;
|
||||
|
||||
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__);
|
||||
if (len <= 0) {
|
||||
if (usepersist)
|
||||
ompi_event_del(ev);
|
||||
opal_event_del(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
roff += len;
|
||||
if (!usepersist)
|
||||
ompi_event_add(ev, NULL);
|
||||
opal_event_add(ev, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -168,14 +168,14 @@ timeout_cb(int fd, short event, void *arg)
|
||||
void
|
||||
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;
|
||||
}
|
||||
|
||||
struct both {
|
||||
struct ompi_event ev;
|
||||
struct opal_event ev;
|
||||
int nread;
|
||||
};
|
||||
|
||||
@ -193,7 +193,7 @@ combined_read_cb(int fd, short event, void *arg)
|
||||
return;
|
||||
|
||||
both->nread += len;
|
||||
ompi_event_add(&both->ev, NULL);
|
||||
opal_event_add(&both->ev, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -216,7 +216,7 @@ combined_write_cb(int fd, short event, void *arg)
|
||||
}
|
||||
|
||||
both->nread -= len;
|
||||
ompi_event_add(&both->ev, NULL);
|
||||
opal_event_add(&both->ev, NULL);
|
||||
}
|
||||
|
||||
/* Test infrastructure */
|
||||
@ -256,7 +256,7 @@ cleanup_test(void)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct ompi_event ev, ev2;
|
||||
struct opal_event ev, ev2;
|
||||
struct timeval tv;
|
||||
struct itimerval itv;
|
||||
struct both r1, r2, w1, w2;
|
||||
@ -265,7 +265,7 @@ main (int argc, char **argv)
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
/* Very simple read test */
|
||||
setup_test("Simple read: ");
|
||||
@ -273,18 +273,18 @@ main (int argc, char **argv)
|
||||
write(pair[0], TEST1, strlen(TEST1)+1);
|
||||
shutdown(pair[0], SHUT_WR);
|
||||
|
||||
ompi_event_set(&ev, pair[1], OMPI_EV_READ, simple_read_cb, &ev);
|
||||
ompi_event_add(&ev, NULL);
|
||||
ompi_event_dispatch();
|
||||
opal_event_set(&ev, pair[1], OPAL_EV_READ, simple_read_cb, &ev);
|
||||
opal_event_add(&ev, NULL);
|
||||
opal_event_dispatch();
|
||||
|
||||
cleanup_test();
|
||||
|
||||
/* Very simple write test */
|
||||
setup_test("Simple write: ");
|
||||
|
||||
ompi_event_set(&ev, pair[0], OMPI_EV_WRITE, simple_write_cb, &ev);
|
||||
ompi_event_add(&ev, NULL);
|
||||
ompi_event_dispatch();
|
||||
opal_event_set(&ev, pair[0], OPAL_EV_WRITE, simple_write_cb, &ev);
|
||||
opal_event_add(&ev, NULL);
|
||||
opal_event_dispatch();
|
||||
|
||||
cleanup_test();
|
||||
|
||||
@ -297,11 +297,11 @@ main (int argc, char **argv)
|
||||
roff = woff = 0;
|
||||
usepersist = 0;
|
||||
|
||||
ompi_event_set(&ev, pair[0], OMPI_EV_WRITE, multiple_write_cb, &ev);
|
||||
ompi_event_add(&ev, NULL);
|
||||
ompi_event_set(&ev2, pair[1], OMPI_EV_READ, multiple_read_cb, &ev2);
|
||||
ompi_event_add(&ev2, NULL);
|
||||
ompi_event_dispatch();
|
||||
opal_event_set(&ev, pair[0], OPAL_EV_WRITE, multiple_write_cb, &ev);
|
||||
opal_event_add(&ev, NULL);
|
||||
opal_event_set(&ev2, pair[1], OPAL_EV_READ, multiple_read_cb, &ev2);
|
||||
opal_event_add(&ev2, NULL);
|
||||
opal_event_dispatch();
|
||||
|
||||
if (roff == woff)
|
||||
test_ok = memcmp(rbuf, wbuf, sizeof(wbuf)) == 0;
|
||||
@ -317,11 +317,11 @@ main (int argc, char **argv)
|
||||
roff = woff = 0;
|
||||
usepersist = 1;
|
||||
|
||||
ompi_event_set(&ev, pair[0], OMPI_EV_WRITE|OMPI_EV_PERSIST, multiple_write_cb, &ev);
|
||||
ompi_event_add(&ev, NULL);
|
||||
ompi_event_set(&ev2, pair[1], OMPI_EV_READ|OMPI_EV_PERSIST, multiple_read_cb, &ev2);
|
||||
ompi_event_add(&ev2, NULL);
|
||||
ompi_event_dispatch();
|
||||
opal_event_set(&ev, pair[0], OPAL_EV_WRITE|OPAL_EV_PERSIST, multiple_write_cb, &ev);
|
||||
opal_event_add(&ev, NULL);
|
||||
opal_event_set(&ev2, pair[1], OPAL_EV_READ|OPAL_EV_PERSIST, multiple_read_cb, &ev2);
|
||||
opal_event_add(&ev2, NULL);
|
||||
opal_event_dispatch();
|
||||
|
||||
if (roff == woff)
|
||||
test_ok = memcmp(rbuf, wbuf, sizeof(wbuf)) == 0;
|
||||
@ -337,16 +337,16 @@ main (int argc, char **argv)
|
||||
w1.nread = 4096;
|
||||
w2.nread = 8192;
|
||||
|
||||
ompi_event_set(&r1.ev, pair[0], OMPI_EV_READ, combined_read_cb, &r1);
|
||||
ompi_event_set(&w1.ev, pair[0], OMPI_EV_WRITE, combined_write_cb, &w1);
|
||||
ompi_event_set(&r2.ev, pair[1], OMPI_EV_READ, combined_read_cb, &r2);
|
||||
ompi_event_set(&w2.ev, pair[1], OMPI_EV_WRITE, combined_write_cb, &w2);
|
||||
ompi_event_add(&r1.ev, NULL);
|
||||
ompi_event_add(&w1.ev, NULL);
|
||||
ompi_event_add(&r2.ev, NULL);
|
||||
ompi_event_add(&w2.ev, NULL);
|
||||
opal_event_set(&r1.ev, pair[0], OPAL_EV_READ, combined_read_cb, &r1);
|
||||
opal_event_set(&w1.ev, pair[0], OPAL_EV_WRITE, combined_write_cb, &w1);
|
||||
opal_event_set(&r2.ev, pair[1], OPAL_EV_READ, combined_read_cb, &r2);
|
||||
opal_event_set(&w2.ev, pair[1], OPAL_EV_WRITE, combined_write_cb, &w2);
|
||||
opal_event_add(&r1.ev, NULL);
|
||||
opal_event_add(&w1.ev, NULL);
|
||||
opal_event_add(&r2.ev, NULL);
|
||||
opal_event_add(&w2.ev, NULL);
|
||||
|
||||
ompi_event_dispatch();
|
||||
opal_event_dispatch();
|
||||
|
||||
if (r1.nread == 8192 && r2.nread == 4096)
|
||||
test_ok = 1;
|
||||
@ -358,26 +358,26 @@ main (int argc, char **argv)
|
||||
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = SECONDS;
|
||||
ompi_evtimer_set(&ev, timeout_cb, NULL);
|
||||
ompi_evtimer_add(&ev, &tv);
|
||||
opal_evtimer_set(&ev, timeout_cb, NULL);
|
||||
opal_evtimer_add(&ev, &tv);
|
||||
|
||||
gettimeofday(&tset, NULL);
|
||||
ompi_event_dispatch();
|
||||
opal_event_dispatch();
|
||||
|
||||
cleanup_test();
|
||||
|
||||
setup_test("Simple signal: ");
|
||||
ompi_signal_set(&ev, SIGALRM, signal_cb, &ev);
|
||||
ompi_signal_add(&ev, NULL);
|
||||
opal_signal_set(&ev, SIGALRM, signal_cb, &ev);
|
||||
opal_signal_add(&ev, NULL);
|
||||
|
||||
memset(&itv, 0, sizeof(itv));
|
||||
itv.it_value.tv_sec = 1;
|
||||
if (setitimer(ITIMER_REAL, &itv, NULL) == -1)
|
||||
goto skip_simplesignal;
|
||||
|
||||
ompi_event_dispatch();
|
||||
opal_event_dispatch();
|
||||
skip_simplesignal:
|
||||
ompi_signal_del(&ev);
|
||||
opal_signal_del(&ev);
|
||||
|
||||
cleanup_test();
|
||||
|
||||
|
@ -40,7 +40,7 @@ read_cb(int fd, short event, void *arg)
|
||||
|
||||
if (len) {
|
||||
if (!called)
|
||||
ompi_event_add(arg, NULL);
|
||||
opal_event_add(arg, NULL);
|
||||
} else if (called == 1)
|
||||
test_okay = 0;
|
||||
|
||||
@ -50,7 +50,7 @@ read_cb(int fd, short event, void *arg)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct ompi_event ev;
|
||||
struct opal_event ev;
|
||||
char *test = "test string";
|
||||
int pair[2];
|
||||
|
||||
@ -62,14 +62,14 @@ main (int argc, char **argv)
|
||||
shutdown(pair[0], SHUT_WR);
|
||||
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ int called = 0;
|
||||
|
||||
#define NEVENT 20000
|
||||
|
||||
struct ompi_event *ev[NEVENT];
|
||||
struct opal_event *ev[NEVENT];
|
||||
|
||||
void
|
||||
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_usec = random() % 50000L;
|
||||
if (tv.tv_usec % 2)
|
||||
ompi_evtimer_add(ev[j], &tv);
|
||||
opal_evtimer_add(ev[j], &tv);
|
||||
else
|
||||
ompi_evtimer_del(ev[j]);
|
||||
opal_evtimer_del(ev[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,19 +55,19 @@ main (int argc, char **argv)
|
||||
int i;
|
||||
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
for (i = 0; i < NEVENT; i++) {
|
||||
ev[i] = malloc(sizeof(struct ompi_event));
|
||||
ev[i] = malloc(sizeof(struct opal_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_usec = random() % 50000L;
|
||||
ompi_evtimer_add(ev[i], &tv);
|
||||
opal_evtimer_add(ev[i], &tv);
|
||||
}
|
||||
|
||||
ompi_event_dispatch();
|
||||
opal_event_dispatch();
|
||||
|
||||
return (called < NEVENT);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ write_cb(int fd, short event, void *arg)
|
||||
|
||||
if (len > 0) {
|
||||
if (!called)
|
||||
ompi_event_add(arg, NULL);
|
||||
opal_event_add(arg, NULL);
|
||||
close(pair[0]);
|
||||
} else if (called == 1)
|
||||
test_okay = 0;
|
||||
@ -53,7 +53,7 @@ write_cb(int fd, short event, void *arg)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct ompi_event ev;
|
||||
struct opal_event ev;
|
||||
|
||||
if (signal(SIGPIPE, SIG_IGN) == SIG_IGN)
|
||||
return (1);
|
||||
@ -62,12 +62,12 @@ main (int argc, char **argv)
|
||||
return (1);
|
||||
|
||||
/* Initalize the event library */
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
|
||||
/* Initalize one event */
|
||||
ompi_event_set(&ev, pair[1], OMPI_EV_WRITE, write_cb, &ev);
|
||||
ompi_event_add(&ev, NULL);
|
||||
ompi_event_dispatch();
|
||||
opal_event_set(&ev, pair[1], OPAL_EV_WRITE, write_cb, &ev);
|
||||
opal_event_add(&ev, NULL);
|
||||
opal_event_dispatch();
|
||||
|
||||
return (test_okay);
|
||||
}
|
||||
|
@ -21,14 +21,14 @@
|
||||
#endif
|
||||
|
||||
#include "opal/runtime/opal_progress.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "include/constants.h"
|
||||
#include "mca/base/mca_base_param.h"
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/*
|
||||
@ -208,7 +208,7 @@ opal_progress(void)
|
||||
if (event_progress_counter-- <= 0 && opal_progress_event_flag != 0) {
|
||||
event_progress_counter =
|
||||
(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
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.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)
|
||||
{
|
||||
if(endpoint->ep_fd >= 0) {
|
||||
ompi_event_del(&endpoint->ep_event);
|
||||
opal_event_del(&endpoint->ep_event);
|
||||
}
|
||||
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 */
|
||||
endpoint->ep_seq += frag->frag_len;
|
||||
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);
|
||||
|
||||
@ -177,7 +177,7 @@ static void orte_iof_base_endpoint_write_handler(int sd, short flags, void *user
|
||||
|
||||
/* is there anything left to write? */
|
||||
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) {
|
||||
opal_condition_signal(&orte_iof_base.iof_condition);
|
||||
}
|
||||
@ -250,19 +250,19 @@ int orte_iof_base_endpoint_create(
|
||||
/* setup event handler */
|
||||
switch(mode) {
|
||||
case ORTE_IOF_SOURCE:
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&endpoint->ep_event,
|
||||
endpoint->ep_fd,
|
||||
OMPI_EV_READ|OMPI_EV_PERSIST,
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
orte_iof_base_endpoint_read_handler,
|
||||
endpoint);
|
||||
ompi_event_add(&endpoint->ep_event, 0);
|
||||
opal_event_add(&endpoint->ep_event, 0);
|
||||
break;
|
||||
case ORTE_IOF_SINK:
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&endpoint->ep_event,
|
||||
endpoint->ep_fd,
|
||||
OMPI_EV_WRITE|OMPI_EV_PERSIST,
|
||||
OPAL_EV_WRITE|OPAL_EV_PERSIST,
|
||||
orte_iof_base_endpoint_write_handler,
|
||||
endpoint);
|
||||
break;
|
||||
@ -312,7 +312,7 @@ int orte_iof_base_endpoint_close(orte_iof_base_endpoint_t* endpoint)
|
||||
endpoint->ep_state = ORTE_IOF_EP_CLOSING;
|
||||
switch(endpoint->ep_mode) {
|
||||
case ORTE_IOF_SOURCE:
|
||||
ompi_event_del(&endpoint->ep_event);
|
||||
opal_event_del(&endpoint->ep_event);
|
||||
if(endpoint->ep_seq == endpoint->ep_ack) {
|
||||
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);
|
||||
opal_list_append(&endpoint->ep_frags, &frag->super);
|
||||
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);
|
||||
} else {
|
||||
@ -451,7 +451,7 @@ int orte_iof_base_endpoint_ack(
|
||||
|
||||
/* check to see if we need to reenable forwarding */
|
||||
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);
|
||||
return ORTE_SUCCESS;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/iof/iof.h"
|
||||
#include "mca/iof/base/iof_base_header.h"
|
||||
|
||||
@ -26,7 +26,7 @@ struct orte_iof_base_endpoint_t {
|
||||
int ep_state;
|
||||
uint32_t ep_seq;
|
||||
uint32_t ep_ack;
|
||||
ompi_event_t ep_event;
|
||||
opal_event_t ep_event;
|
||||
opal_list_t ep_frags;
|
||||
};
|
||||
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)
|
||||
{
|
||||
opal_list_item_t* item;
|
||||
ompi_event_t ev;
|
||||
opal_event_t ev;
|
||||
struct timeval tv = { 0, 0 };
|
||||
int flushed = 0;
|
||||
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
|
||||
*/
|
||||
|
||||
if(ompi_event_progress_thread() == false) {
|
||||
if(opal_event_progress_thread() == false) {
|
||||
OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
|
||||
ompi_evtimer_set(&ev, orte_iof_base_timer_cb, &flushed);
|
||||
ompi_event_add(&ev, &tv);
|
||||
opal_evtimer_set(&ev, orte_iof_base_timer_cb, &flushed);
|
||||
opal_event_add(&ev, &tv);
|
||||
while(flushed == 0)
|
||||
opal_condition_wait(&orte_iof_base.iof_condition, &orte_iof_base.iof_lock);
|
||||
} else {
|
||||
ompi_event_loop(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
||||
OPAL_THREAD_LOCK(&orte_iof_base.iof_lock);
|
||||
}
|
||||
orte_iof_base.iof_waiting++;
|
||||
@ -79,11 +79,11 @@ int orte_iof_base_flush(void)
|
||||
}
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "ompi_config.h"
|
||||
#include "opal/class/opal_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/base/base.h"
|
||||
#include "mca/iof/base/iof_base_header.h"
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
struct mca_oob_tcp_event_t {
|
||||
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;
|
||||
|
||||
@ -267,8 +267,8 @@ static void mca_oob_tcp_accept(void)
|
||||
|
||||
/* wait for receipt of peers process identifier to complete this connection */
|
||||
event = OBJ_NEW(mca_oob_tcp_event_t);
|
||||
ompi_event_set(&event->event, sd, OMPI_EV_READ, mca_oob_tcp_recv_handler, event);
|
||||
ompi_event_add(&event->event, 0);
|
||||
opal_event_set(&event->event, sd, OPAL_EV_READ, mca_oob_tcp_recv_handler, event);
|
||||
opal_event_add(&event->event, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,13 +325,13 @@ static int mca_oob_tcp_create_listen(void)
|
||||
}
|
||||
|
||||
/* register listen port */
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&mca_oob_tcp_component.tcp_recv_event,
|
||||
mca_oob_tcp_component.tcp_listen_sd,
|
||||
OMPI_EV_READ|OMPI_EV_PERSIST,
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
mca_oob_tcp_recv_handler,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -514,8 +514,8 @@ mca_oob_t* mca_oob_tcp_component_init(int* priority)
|
||||
8); /* increment to grow by */
|
||||
|
||||
/* intialize event library */
|
||||
memset(&mca_oob_tcp_component.tcp_recv_event, 0, sizeof(ompi_event_t));
|
||||
memset(&mca_oob_tcp_component.tcp_send_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(opal_event_t));
|
||||
|
||||
/* create a listen socket */
|
||||
if(mca_oob_tcp_create_listen() != OMPI_SUCCESS) {
|
||||
@ -989,11 +989,11 @@ int mca_oob_tcp_fini(void)
|
||||
{
|
||||
opal_list_item_t *item;
|
||||
OPAL_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
ompi_event_disable(); /* disable event processing */
|
||||
opal_event_disable(); /* disable event processing */
|
||||
|
||||
/* close listen socket */
|
||||
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);
|
||||
mca_oob_tcp_component.tcp_listen_sd = -1;
|
||||
}
|
||||
@ -1011,11 +1011,11 @@ int mca_oob_tcp_fini(void)
|
||||
item != NULL;
|
||||
item = opal_list_remove_first(&mca_oob_tcp_component.tcp_events)) {
|
||||
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);
|
||||
}
|
||||
|
||||
ompi_event_enable();
|
||||
opal_event_enable();
|
||||
OPAL_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "mca/ns/ns_types.h"
|
||||
#include "opal/class/opal_free_list.h"
|
||||
#include "class/opal_hash_table.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "opal/threads/condition.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_retries; /**< max number of retries before declaring peer gone */
|
||||
opal_free_list_t tcp_msgs; /**< free list of messages */
|
||||
ompi_event_t tcp_send_event; /**< event structure for sends */
|
||||
ompi_event_t tcp_recv_event; /**< event structure for recvs */
|
||||
opal_event_t tcp_send_event; /**< event structure for sends */
|
||||
opal_event_t tcp_recv_event; /**< event structure for recvs */
|
||||
opal_mutex_t tcp_lock; /**< lock for accessing module state */
|
||||
opal_list_t tcp_events; /**< list of pending events (accepts) */
|
||||
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
|
||||
OPAL_THREAD_LOCK(&msg->msg_lock);
|
||||
while(msg->msg_complete == false) {
|
||||
if(ompi_event_progress_thread()) {
|
||||
if(opal_event_progress_thread()) {
|
||||
int rc;
|
||||
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
||||
rc = ompi_event_loop(OMPI_EVLOOP_ONCE);
|
||||
rc = opal_event_loop(OPAL_EVLOOP_ONCE);
|
||||
assert(rc >= 0);
|
||||
OPAL_THREAD_LOCK(&msg->msg_lock);
|
||||
} else {
|
||||
@ -79,7 +79,7 @@ int mca_oob_tcp_msg_wait(mca_oob_tcp_msg_t* msg, int* rc)
|
||||
#else
|
||||
/* wait for message to complete */
|
||||
while(msg->msg_complete == false)
|
||||
ompi_event_loop(OMPI_EVLOOP_ONCE);
|
||||
opal_event_loop(OPAL_EVLOOP_ONCE);
|
||||
#endif
|
||||
|
||||
/* 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 &&
|
||||
((uint32_t)tv.tv_sec <= secs ||
|
||||
((uint32_t)tv.tv_sec == secs && (uint32_t)tv.tv_usec < usecs))) {
|
||||
if(ompi_event_progress_thread()) {
|
||||
if(opal_event_progress_thread()) {
|
||||
int rc;
|
||||
OPAL_THREAD_UNLOCK(&msg->msg_lock);
|
||||
rc = ompi_event_loop(OMPI_EVLOOP_ONCE);
|
||||
rc = opal_event_loop(OPAL_EVLOOP_ONCE);
|
||||
assert(rc >= 0);
|
||||
OPAL_THREAD_LOCK(&msg->msg_lock);
|
||||
} 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 &&
|
||||
((uint32_t)tv.tv_sec <= secs ||
|
||||
((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);
|
||||
}
|
||||
#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_recv_event, 0, sizeof(peer->peer_recv_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_send_event, 0, sizeof(peer->peer_send_event));
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&peer->peer_recv_event,
|
||||
peer->peer_sd,
|
||||
OMPI_EV_READ|OMPI_EV_PERSIST,
|
||||
OPAL_EV_READ|OPAL_EV_PERSIST,
|
||||
mca_oob_tcp_peer_recv_handler,
|
||||
peer);
|
||||
ompi_event_set(
|
||||
opal_event_set(
|
||||
&peer->peer_send_event,
|
||||
peer->peer_sd,
|
||||
OMPI_EV_WRITE|OMPI_EV_PERSIST,
|
||||
OPAL_EV_WRITE|OPAL_EV_PERSIST,
|
||||
mca_oob_tcp_peer_send_handler,
|
||||
peer);
|
||||
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(!mca_oob_tcp_msg_send_handler(msg, peer)) {
|
||||
peer->peer_send_msg = msg;
|
||||
ompi_event_add(&peer->peer_send_event, 0);
|
||||
opal_event_add(&peer->peer_send_event, 0);
|
||||
} else {
|
||||
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)),
|
||||
ompi_socket_errno);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ static int mca_oob_tcp_peer_start_connect(mca_oob_tcp_peer_t* peer)
|
||||
/* non-blocking so wait for completion */
|
||||
IMPORTANT_WINDOWS_COMMENT();
|
||||
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;
|
||||
}
|
||||
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 */
|
||||
if((rc = mca_oob_tcp_peer_send_connect_ack(peer)) == OMPI_SUCCESS) {
|
||||
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 {
|
||||
ompi_output(0,
|
||||
"[%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);
|
||||
|
||||
/* unregister from receiving event notifications */
|
||||
ompi_event_del(&peer->peer_send_event);
|
||||
opal_event_del(&peer->peer_send_event);
|
||||
|
||||
/* check connect completion status */
|
||||
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;
|
||||
}
|
||||
if(so_error == EINPROGRESS) {
|
||||
ompi_event_add(&peer->peer_send_event, 0);
|
||||
opal_event_add(&peer->peer_send_event, 0);
|
||||
return;
|
||||
} else if (so_error == ECONNREFUSED || so_error == ETIMEDOUT) {
|
||||
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)),
|
||||
so_error, getpid());
|
||||
mca_oob_tcp_peer_shutdown(peer);
|
||||
ompi_evtimer_add(&peer->peer_timer_event, &tv);
|
||||
opal_evtimer_add(&peer->peer_timer_event, &tv);
|
||||
return;
|
||||
} 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",
|
||||
@ -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) {
|
||||
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 {
|
||||
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),
|
||||
@ -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)
|
||||
{
|
||||
ompi_event_del(&peer->peer_timer_event);
|
||||
opal_event_del(&peer->peer_timer_event);
|
||||
peer->peer_state = MCA_OOB_TCP_CONNECTED;
|
||||
peer->peer_retries = 0;
|
||||
if(opal_list_get_size(&peer->peer_send_queue) > 0) {
|
||||
if(NULL == peer->peer_send_msg)
|
||||
peer->peer_send_msg = (mca_oob_tcp_msg_t*)
|
||||
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) {
|
||||
ompi_event_del(&peer->peer_recv_event);
|
||||
ompi_event_del(&peer->peer_send_event);
|
||||
opal_event_del(&peer->peer_recv_event);
|
||||
opal_event_del(&peer->peer_send_event);
|
||||
close(peer->peer_sd);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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(NULL == peer->peer_send_msg) {
|
||||
ompi_event_del(&peer->peer_send_event);
|
||||
opal_event_del(&peer->peer_send_event);
|
||||
}
|
||||
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(&(peer->peer_name)),
|
||||
peer->peer_state);
|
||||
ompi_event_del(&peer->peer_send_event);
|
||||
opal_event_del(&peer->peer_send_event);
|
||||
break;
|
||||
}
|
||||
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);
|
||||
ompi_event_add(&peer->peer_recv_event, 0);
|
||||
opal_event_add(&peer->peer_recv_event, 0);
|
||||
if(mca_oob_tcp_component.tcp_debug > 0) {
|
||||
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 */
|
||||
mca_oob_tcp_addr_t* peer_addr; /**< the addresses of the peer process */
|
||||
int peer_sd; /**< socket descriptor of the connection */
|
||||
ompi_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 */
|
||||
ompi_event_t peer_timer_event; /**< timer for retrying connection failures */
|
||||
opal_event_t peer_send_event; /**< registration with event thread for send events */
|
||||
opal_event_t peer_recv_event; /**< registration with event thread for recv events */
|
||||
opal_event_t peer_timer_event; /**< timer for retrying connection failures */
|
||||
opal_mutex_t peer_lock; /**< protect critical data structures */
|
||||
opal_list_t peer_send_queue; /**< list of messages to send */
|
||||
mca_oob_tcp_msg_t *peer_send_msg; /**< current send in progress */
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "util/output.h"
|
||||
#include "util/ompi_environ.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "runtime/orte_wait.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "mca/ns/base/base.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "util/output.h"
|
||||
#include "util/ompi_environ.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "runtime/orte_wait.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "mca/ns/base/base.h"
|
||||
@ -843,14 +843,14 @@ complete:
|
||||
int orte_pls_bproc_seed_launch_threaded(orte_jobid_t jobid)
|
||||
{
|
||||
struct timeval tv = { 0, 0 };
|
||||
struct ompi_event event;
|
||||
struct opal_event event;
|
||||
struct orte_pls_bproc_stack_t stack;
|
||||
|
||||
OBJ_CONSTRUCT(&stack, orte_pls_bproc_stack_t);
|
||||
|
||||
stack.jobid = jobid;
|
||||
ompi_evtimer_set(&event, orte_pls_bproc_seed_launch_cb, &stack);
|
||||
ompi_evtimer_add(&event, &tv);
|
||||
opal_evtimer_set(&event, orte_pls_bproc_seed_launch_cb, &stack);
|
||||
opal_evtimer_add(&event, &tv);
|
||||
|
||||
OPAL_THREAD_LOCK(&stack.mutex);
|
||||
while(stack.complete == false)
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <signal.h>
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/output.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 ompi_event event;
|
||||
struct opal_event event;
|
||||
struct orte_pls_fork_stack_t stack;
|
||||
|
||||
OBJ_CONSTRUCT(&stack, orte_pls_fork_stack_t);
|
||||
|
||||
stack.jobid = jobid;
|
||||
ompi_evtimer_set(&event, orte_pls_fork_launch_cb, &stack);
|
||||
ompi_evtimer_add(&event, &tv);
|
||||
opal_evtimer_set(&event, orte_pls_fork_launch_cb, &stack);
|
||||
opal_evtimer_add(&event, &tv);
|
||||
|
||||
OPAL_THREAD_LOCK(&stack.mutex);
|
||||
while(false == stack.complete) {
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "util/session_dir.h"
|
||||
#include "util/if.h"
|
||||
#include "util/path.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "runtime/orte_wait.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)
|
||||
{
|
||||
struct timeval tv = { 0, 0 };
|
||||
struct ompi_event event;
|
||||
struct opal_event event;
|
||||
struct orte_pls_rsh_stack_t stack;
|
||||
|
||||
OBJ_CONSTRUCT(&stack, orte_pls_rsh_stack_t);
|
||||
|
||||
stack.jobid = jobid;
|
||||
ompi_evtimer_set(&event, orte_pls_rsh_launch_cb, &stack);
|
||||
ompi_evtimer_add(&event, &tv);
|
||||
opal_evtimer_set(&event, orte_pls_rsh_launch_cb, &stack);
|
||||
opal_evtimer_add(&event, &tv);
|
||||
|
||||
OPAL_THREAD_LOCK(&stack.mutex);
|
||||
while(stack.complete == false)
|
||||
|
@ -34,7 +34,7 @@
|
||||
#import "util/argv.h"
|
||||
#import "util/output.h"
|
||||
#import "util/session_dir.h"
|
||||
#import "event/event.h"
|
||||
#import "opal/event/event.h"
|
||||
#import "runtime/orte_wait.h"
|
||||
#import "mca/ns/ns.h"
|
||||
#import "mca/pls/pls.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#endif
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/output.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "dps/dps.h"
|
||||
@ -116,7 +116,7 @@ int orte_init_stage1(void)
|
||||
/*
|
||||
* Initialize the event library
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = ompi_event_init())) {
|
||||
if (OMPI_SUCCESS != (ret = opal_event_init())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "util/sys_info.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "util/output.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "opal/threads/condition.h"
|
||||
#include "mca/ns/ns_types.h"
|
||||
|
@ -24,9 +24,9 @@
|
||||
#endif
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/output.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.h"
|
||||
@ -70,7 +70,7 @@ int orte_restart(orte_process_name_t *name, const char* uri)
|
||||
* Restart event library
|
||||
*/
|
||||
|
||||
if (ORTE_SUCCESS != (rc = ompi_event_restart())) {
|
||||
if (ORTE_SUCCESS != (rc = opal_event_restart())) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
#include "dps/dps.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "opal/threads/condition.h"
|
||||
#include "runtime/orte_wait.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "include/orte_constants.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "runtime/orte_wait.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "mca/rml/base/base.h"
|
||||
#include "dps/dps.h"
|
||||
#include "mca/ns/base/base.h"
|
||||
@ -67,7 +67,7 @@ int orte_system_finalize(void)
|
||||
|
||||
opal_progress_finalize();
|
||||
|
||||
ompi_event_fini();
|
||||
opal_event_fini();
|
||||
|
||||
#ifndef WIN32
|
||||
orte_session_dir_finalize(orte_process_info.my_name);
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "util/output.h"
|
||||
#include "opal/class/opal_object.h"
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "include/constants.h"
|
||||
#include "opal/threads/mutex.h"
|
||||
#include "opal/threads/condition.h"
|
||||
@ -124,7 +124,7 @@ static volatile int cb_enabled = true;
|
||||
static opal_mutex_t mutex;
|
||||
static opal_list_t pending_pids;
|
||||
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(®istered_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,
|
||||
&handler);
|
||||
|
||||
ompi_event_add(&handler, NULL);
|
||||
opal_event_add(&handler, NULL);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ orte_wait_finalize(void)
|
||||
opal_list_item_t *item;
|
||||
|
||||
OPAL_THREAD_LOCK(&mutex);
|
||||
ompi_event_del(&handler);
|
||||
opal_event_del(&handler);
|
||||
|
||||
/* clear out the lists */
|
||||
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 (opal_using_threads()) {
|
||||
opal_mutex_unlock(&mutex);
|
||||
ompi_event_loop(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
||||
opal_mutex_lock(&mutex);
|
||||
}
|
||||
#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
|
||||
for long. */
|
||||
|
||||
if (!OMPI_HAVE_THREAD_SUPPORT || ompi_event_progress_thread()) {
|
||||
ompi_event_loop(OMPI_EVLOOP_NONBLOCK);
|
||||
if (!OMPI_HAVE_THREAD_SUPPORT || opal_event_progress_thread()) {
|
||||
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,9 +355,9 @@ orte_wait_cb_cancel(pid_t wpid)
|
||||
void
|
||||
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);
|
||||
do_waitall(0);
|
||||
@ -559,9 +559,9 @@ internal_waitpid(pid_t pid, int *status, int options)
|
||||
#if OMPI_THREADS_HAVE_DIFFERENT_PIDS
|
||||
waitpid_callback_data_t data;
|
||||
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 */
|
||||
return waitpid(pid, status, options);
|
||||
}
|
||||
@ -577,8 +577,8 @@ internal_waitpid(pid_t pid, int *status, int options)
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
ompi_evtimer_set(&ev, internal_waitpid_callback, &data);
|
||||
ompi_evtimer_add(&ev, &tv);
|
||||
opal_evtimer_set(&ev, internal_waitpid_callback, &data);
|
||||
opal_evtimer_add(&ev, &tv);
|
||||
|
||||
while (data.done == false) {
|
||||
opal_condition_wait(&(data.cond), &(data.mutex));
|
||||
|
@ -37,7 +37,7 @@
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "include/constants.h"
|
||||
|
||||
#include "util/argv.h"
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "opal/threads/condition.h"
|
||||
|
||||
#include "dps/dps.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "util/argv.h"
|
||||
#include "util/path.h"
|
||||
#include "util/output.h"
|
||||
@ -235,7 +235,7 @@ int main(int argc, char *argv[])
|
||||
/*
|
||||
* Initialize the event library
|
||||
*/
|
||||
if (OMPI_SUCCESS != (ret = ompi_event_init())) {
|
||||
if (OMPI_SUCCESS != (ret = opal_event_init())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "class/orte_pointer_array.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "util/argv.h"
|
||||
@ -65,8 +65,8 @@ extern char** environ;
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
static struct ompi_event term_handler;
|
||||
static struct ompi_event int_handler;
|
||||
static struct opal_event term_handler;
|
||||
static struct opal_event int_handler;
|
||||
static orte_jobid_t jobid = ORTE_JOBID_MAX;
|
||||
static orte_pointer_array_t *apps_pa;
|
||||
static bool wait_for_job_completion = true;
|
||||
@ -334,12 +334,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* 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);
|
||||
ompi_event_add(&term_handler, NULL);
|
||||
ompi_event_set(&int_handler, SIGINT, OMPI_EV_SIGNAL,
|
||||
opal_event_add(&term_handler, NULL);
|
||||
opal_event_set(&int_handler, SIGINT, OPAL_EV_SIGNAL,
|
||||
signal_callback, NULL);
|
||||
ompi_event_add(&int_handler, NULL);
|
||||
opal_event_add(&int_handler, NULL);
|
||||
|
||||
/* Spawn the job */
|
||||
|
||||
@ -562,7 +562,7 @@ static void signal_callback(int fd, short flags, void *arg)
|
||||
{
|
||||
int ret;
|
||||
struct timeval tv = { 5, 0 };
|
||||
ompi_event_t* event;
|
||||
opal_event_t* event;
|
||||
|
||||
static int signalled = 0;
|
||||
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)))) {
|
||||
ompi_evtimer_set(event, exit_callback, NULL);
|
||||
ompi_evtimer_add(event, &tv);
|
||||
if (NULL != (event = (opal_event_t*)malloc(sizeof(opal_event_t)))) {
|
||||
opal_evtimer_set(event, exit_callback, NULL);
|
||||
opal_evtimer_add(event, &tv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "util/sys_info.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "util/output.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.h"
|
||||
@ -84,8 +84,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* initialize event library */
|
||||
if (OMPI_SUCCESS != ompi_event_init()) {
|
||||
fprintf(test_out, "ompi_event_init failed - please report error to bugs@open-mpi.org\n");
|
||||
if (OMPI_SUCCESS != opal_event_init()) {
|
||||
fprintf(test_out, "opal_event_init failed - please report error to bugs@open-mpi.org\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -115,11 +115,11 @@ int main(int argc, char **argv)
|
||||
int status;
|
||||
if(waitpid(pid, &status, WNOHANG) != 0)
|
||||
break;
|
||||
ompi_event_loop(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "setenv OMPI_MCA_oob_base_seed %s\n", mca_oob_get_contact_info());
|
||||
ompi_event_loop(0);
|
||||
opal_event_loop(0);
|
||||
#endif
|
||||
return(0);
|
||||
} else {
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "util/sys_info.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "util/output.h"
|
||||
#include "event/event.h"
|
||||
#include "opal/event/event.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/base/base.h"
|
||||
@ -79,8 +79,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* initialize event library */
|
||||
if (OMPI_SUCCESS != ompi_event_init()) {
|
||||
fprintf(test_out, "ompi_event_init failed - please report error to bugs@open-mpi.org\n");
|
||||
if (OMPI_SUCCESS != opal_event_init()) {
|
||||
fprintf(test_out, "opal_event_init failed - please report error to bugs@open-mpi.org\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -110,11 +110,11 @@ int main(int argc, char **argv)
|
||||
int status;
|
||||
if(waitpid(pid, &status, WNOHANG) != 0)
|
||||
break;
|
||||
ompi_event_loop(OMPI_EVLOOP_NONBLOCK);
|
||||
opal_event_loop(OPAL_EVLOOP_NONBLOCK);
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "OMPI_MCA_oob_base_seed=%s", mca_oob_get_contact_info());
|
||||
ompi_event_loop(0);
|
||||
opal_event_loop(0);
|
||||
#endif
|
||||
} else {
|
||||
run_test();
|
||||
|
@ -23,7 +23,7 @@ int main(int argc, char **argv) {
|
||||
WSAStartup (MAKE_WORD(2,2), &winsockdata);
|
||||
|
||||
ompi_init();
|
||||
ompi_event_init();
|
||||
opal_event_init();
|
||||
WSACleanup();
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user