1
1

Convert the opal_event framework to use direct function calls instead of hiding functions behind function pointers. Eliminate the opal_object_t abstraction of libevent's event struct so it can be directly passed to the libevent functions.

Note: the ompi_check_libfca.m4 file had to be modified to avoid it stomping on global CPPFLAGS and the like. The file was also relocated to the ompi/config directory as it pertains solely to an ompi-layer component.

Forgive the mid-day configure change, but I know Shiqing is working the windows issues and don't want to cause him unnecessary redo work.

This commit was SVN r23966.
This commit is contained in:
Ralph Castain 2010-10-28 15:22:46 +00:00
parent c13b0bb668
commit 9ea2b196ce
67 changed files with 692 additions and 1027 deletions

View File

@ -22,14 +22,14 @@ AC_DEFUN([OMPI_CHECK_FCA],[
AS_IF([test "$with_fca" != "no"],
[AS_IF([test ! -z "$with_fca" -a "$with_fca" != "yes"],
[ompi_check_fca_dir="$with_fca"
[ompi_check_fca_dir=$with_fca
ompi_check_fca_libdir="$ompi_check_fca_dir/lib"
ompi_check_fca_incdir="$ompi_check_fca_dir/include"
ompi_check_fca_libs="fca"
ompi_check_fca_libs=fca
CPPFLAGS_save="$CPPFLAGS"
LDFLAGS_save="$LDFLAGS"
LIBS_save="$LIBS"
CPPFLAGS_save=$CPPFLAGS
LDFLAGS_save=$LDFLAGS
LIBS_save=$LIBS
CPPFLAGS="$CPPFLAGS -I$ompi_check_fca_dir/include/fca -I$ompi_check_fca_dir/include/fca_core"
OMPI_LOG_MSG([$1_CPPFLAGS : $$1_CPPFLAGS], 1)
@ -44,14 +44,13 @@ AC_DEFUN([OMPI_CHECK_FCA],[
[$ompi_check_fca_dir],
[$ompi_check_fca_libdir],
[ompi_check_fca_happy="yes"],
[ompi_check_fca_happy="no"])],
[ompi_check_fca_happy="no"])
CPPFLAGS=$CPPFLAGS_save
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save],
[ompi_check_fca_happy="no"])
CPPFLAGS="$CPPFLAGS_save"
LDFLAGS="$LDFLAGS_save"
LIBS="$LIBS_save"
])
])
AS_IF([test "$ompi_check_fca_happy" = "yes" -a "$enable_progress_threads" = "yes"],
[AC_MSG_WARN([fca driver does not currently support progress threads. Disabling FCA.])

View File

@ -39,7 +39,7 @@ int mca_btl_base_close(void)
}
#if 0
/* disable event processing while cleaning up btls */
opal_event.disable();
opal_event_disable();
#endif
/* Finalize all the btl components and free their list items */
@ -72,7 +72,7 @@ int mca_btl_base_close(void)
#if 0
/* restore event processing */
opal_event.enable();
opal_event_enable();
#endif
/* All done */
return OMPI_SUCCESS;

View File

@ -174,11 +174,10 @@ static int service_pipe_cmd_add_fd(bool use_libevent, cmd_t *cmd)
if (use_libevent) {
/* Make an event for this fd */
ri->ri_event_used = true;
OBJ_CONSTRUCT(&ri->ri_event, opal_event_t);
opal_event.set(opal_event_base, &ri->ri_event, ri->ri_fd,
opal_event_set(opal_event_base, &ri->ri_event, ri->ri_fd,
ri->ri_flags | OPAL_EV_PERSIST, service_fd_callback,
ri);
opal_event.add(&ri->ri_event, 0);
opal_event_add(&ri->ri_event, 0);
} else {
/* Add the fd to the relevant fd local sets and update max_fd */
if (OPAL_EV_READ & ri->ri_flags) {
@ -237,8 +236,7 @@ static int service_pipe_cmd_remove_fd(cmd_t *cmd)
event or an entry in the local fd sets. */
if (ri->ri_event_used) {
/* Remove this event from libevent */
opal_event.del(&ri->ri_event);
OBJ_DESTRUCT(&ri->ri_event);
opal_event_del(&ri->ri_event);
} else {
/* Remove this item from the fd_sets and recalculate
MAX_FD */
@ -482,17 +480,16 @@ int ompi_btl_openib_fd_init(void)
/* Create a libevent event that is used in the main thread
to watch its pipe */
OBJ_CONSTRUCT(&main_thread_event, opal_event_t);
opal_event.set(opal_event_base, &main_thread_event, pipe_to_main_thread[0],
opal_event_set(opal_event_base, &main_thread_event, pipe_to_main_thread[0],
OPAL_EV_READ | OPAL_EV_PERSIST,
main_thread_event_callback, NULL);
opal_event.add(&main_thread_event, 0);
opal_event_add(&main_thread_event, 0);
/* Start the service thread */
if (0 != pthread_create(&thread, NULL, service_thread_start,
NULL)) {
int errno_save = errno;
opal_event.del(&main_thread_event);
opal_event_del(&main_thread_event);
close(pipe_to_service_thread[0]);
close(pipe_to_service_thread[1]);
close(pipe_to_main_thread[0]);
@ -664,7 +661,7 @@ int ompi_btl_openib_fd_finalize(void)
/* For the threaded version, send a command down the pipe */
cmd_t cmd;
OPAL_OUTPUT((-1, "shutting down openib fd"));
opal_event.del(&main_thread_event);
opal_event_del(&main_thread_event);
memset(&cmd, 0, cmd_size);
cmd.pc_cmd = CMD_TIME_TO_QUIT;
opal_fd_write(pipe_to_service_thread[1], cmd_size, &cmd);
@ -672,8 +669,7 @@ int ompi_btl_openib_fd_finalize(void)
pthread_join(thread, NULL);
opal_atomic_rmb();
opal_event.del(&main_thread_event);
OBJ_DESTRUCT(&main_thread_event);
opal_event_del(&main_thread_event);
close(pipe_to_service_thread[0]);
close(pipe_to_service_thread[1]);

View File

@ -138,7 +138,6 @@ typedef struct mca_btl_sctp_event_t mca_btl_sctp_event_t;
static void mca_btl_sctp_event_construct(mca_btl_sctp_event_t* event)
{
OPAL_THREAD_LOCK(&mca_btl_sctp_component.sctp_lock);
OBJ_CONSTRUCT(&event->event, opal_event_t);
opal_list_append(&mca_btl_sctp_component.sctp_events, &event->item);
OPAL_THREAD_UNLOCK(&mca_btl_sctp_component.sctp_lock);
}
@ -147,7 +146,6 @@ static void mca_btl_sctp_event_destruct(mca_btl_sctp_event_t* event)
{
OPAL_THREAD_LOCK(&mca_btl_sctp_component.sctp_lock);
opal_list_remove_item(&mca_btl_sctp_component.sctp_events, &event->item);
OBJ_DESTRUCT(&event->event);
OPAL_THREAD_UNLOCK(&mca_btl_sctp_component.sctp_lock);
}
@ -289,8 +287,7 @@ int mca_btl_sctp_component_close(void)
mca_btl_sctp_recv_handler_freebuf();
if (mca_btl_sctp_component.sctp_listen_sd >= 0) {
opal_event.del(&mca_btl_sctp_component.sctp_recv_event);
OBJ_DESTRUCT(&mca_btl_sctp_component.sctp_recv_event);
opal_event_del(&mca_btl_sctp_component.sctp_recv_event);
CLOSE_THE_SOCKET(mca_btl_sctp_component.sctp_listen_sd);
mca_btl_sctp_component.sctp_listen_sd = -1;
}
@ -302,7 +299,7 @@ int mca_btl_sctp_component_close(void)
item = next) {
mca_btl_sctp_event_t* event = (mca_btl_sctp_event_t*)item;
next = opal_list_get_next(item);
opal_event.del(&event->event);
opal_event_del(&event->event);
OBJ_RELEASE(event);
}
OPAL_THREAD_UNLOCK(&mca_btl_sctp_component.sctp_lock);
@ -555,8 +552,6 @@ static int mca_btl_sctp_component_create_instance(void)
static int mca_btl_sctp_component_create_listen(void)
{
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_recv_event, opal_event_t);
if(mca_btl_sctp_component.sctp_if_11) {
/* 1 to 1 */
int rc;
@ -605,13 +600,13 @@ static int mca_btl_sctp_component_create_listen(void)
/* register listen port */
opal_event.set(opal_event_base,
opal_event_set(opal_event_base,
&mca_btl_sctp_component.sctp_recv_event,
mca_btl_sctp_component.sctp_listen_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_sctp_component_recv_handler,
0);
opal_event.add(&mca_btl_sctp_component.sctp_recv_event,0);
opal_event_add(&mca_btl_sctp_component.sctp_recv_event,0);
return OMPI_SUCCESS;
}
@ -655,13 +650,13 @@ static int mca_btl_sctp_component_register_listen(void)
/* register listen port */
opal_event.set(opal_event_base,
opal_event_set(opal_event_base,
&mca_btl_sctp_component.sctp_recv_event,
mca_btl_sctp_component.sctp_listen_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_sctp_recv_handler,
0);
opal_event.add(&mca_btl_sctp_component.sctp_recv_event,0);
opal_event_add(&mca_btl_sctp_component.sctp_recv_event,0);
return OMPI_SUCCESS;
}
@ -896,8 +891,8 @@ void mca_btl_sctp_component_accept(void)
/* wait for receipt of peers process identifier to complete this connection */
event = OBJ_NEW(mca_btl_sctp_event_t);
opal_event.set(opal_event_base, &event->event, sd, OPAL_EV_READ, mca_btl_sctp_component_recv_handler, event);
opal_event.add(&event->event, 0);
opal_event_set(opal_event_base, &event->event, sd, OPAL_EV_READ, mca_btl_sctp_component_recv_handler, event);
opal_event_add(&event->event, 0);
}
}
@ -916,8 +911,8 @@ void mca_btl_sctp_component_accept(void)
/* wait for receipt of peers process identifier to complete this connection */
event = OBJ_NEW(mca_btl_sctp_event_t);
opal_event.set(opal_event_base, &event->event, sd, OPAL_EV_READ, mca_btl_sctp_recv_handler, event);
opal_event.add(&event->event, 0);
opal_event_set(opal_event_base, &event->event, sd, OPAL_EV_READ, mca_btl_sctp_recv_handler, event);
opal_event_add(&event->event, 0);
}
}

View File

@ -109,8 +109,6 @@ static void mca_btl_sctp_endpoint_construct(mca_btl_sctp_endpoint_t* endpoint)
endpoint->endpoint_sd = -1;
endpoint->endpoint_send_frag = 0;
endpoint->endpoint_recv_frag = 0;
OBJ_CONSTRUCT(&endpoint->endpoint_send_event, opal_event_t);
OBJ_CONSTRUCT(&endpoint->endpoint_recv_event, opal_event_t);
endpoint->endpoint_state = MCA_BTL_SCTP_CLOSED;
endpoint->endpoint_retries = 0;
endpoint->endpoint_nbo = false;
@ -182,8 +180,6 @@ static void mca_btl_sctp_endpoint_destruct(mca_btl_sctp_endpoint_t* endpoint)
free(chunkp);
}
}
OBJ_DESTRUCT(&endpoint->endpoint_send_event);
OBJ_DESTRUCT(&endpoint->endpoint_recv_event);
}
OBJ_CLASS_INSTANCE(
@ -273,12 +269,12 @@ static inline void mca_btl_sctp_endpoint_event_init(mca_btl_base_endpoint_t* btl
btl_endpoint->endpoint_cache_pos = btl_endpoint->endpoint_cache;
#endif /* MCA_BTL_SCTP_ENDPOINT_CACHE */
opal_event.set(opal_event_base, &btl_endpoint->endpoint_recv_event,
opal_event_set(opal_event_base, &btl_endpoint->endpoint_recv_event,
btl_endpoint->endpoint_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_sctp_endpoint_recv_handler,
btl_endpoint );
opal_event.set(opal_event_base, &btl_endpoint->endpoint_send_event,
opal_event_set(opal_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE|OPAL_EV_PERSIST,
mca_btl_sctp_endpoint_send_handler,
@ -297,12 +293,12 @@ static inline void mca_btl_sctp_endpoint_event_init(mca_btl_base_endpoint_t* btl
btl_endpoint->endpoint_cache_pos = btl_endpoint->endpoint_cache;
#endif /* MCA_BTL_SCTP_ENDPOINT_CACHE */
opal_event.set(opal_event_base, &btl_endpoint->endpoint_recv_event,
opal_event_set(opal_event_base, &btl_endpoint->endpoint_recv_event,
btl_endpoint->endpoint_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_sctp_recv_handler,
btl_endpoint );
opal_event.set(opal_event_base, &btl_endpoint->endpoint_send_event,
opal_event_set(opal_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE|OPAL_EV_PERSIST,
mca_btl_sctp_endpoint_send_handler,
@ -353,7 +349,7 @@ int mca_btl_sctp_endpoint_send(mca_btl_base_endpoint_t* btl_endpoint, mca_btl_sc
return OMPI_SUCCESS;
} else {
btl_endpoint->endpoint_send_frag = frag;
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
}
} else {
opal_list_append(&btl_endpoint->endpoint_frags, (opal_list_item_t*)frag);
@ -459,7 +455,7 @@ int mca_btl_sctp_endpoint_send(mca_btl_base_endpoint_t* btl_endpoint, mca_btl_sc
} else {
/* no endpoint is currently associated with sending on this socket */
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
endpoint_associated_with_send = btl_endpoint;
}
}
@ -599,7 +595,7 @@ bool mca_btl_sctp_endpoint_accept(mca_btl_base_endpoint_t* btl_endpoint, struct
return false;
}
mca_btl_sctp_endpoint_event_init(btl_endpoint, sd);
opal_event.add(&btl_endpoint->endpoint_recv_event, 0);
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
mca_btl_sctp_endpoint_connected(btl_endpoint);
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
mca_btl_sctp_endpoint_dump(btl_endpoint, "accepted");
@ -624,7 +620,7 @@ bool mca_btl_sctp_endpoint_accept(mca_btl_base_endpoint_t* btl_endpoint, struct
/* conflicts can't happen with one-to-many socket */
mca_btl_sctp_endpoint_event_init(btl_endpoint, sd);
opal_event.add(&btl_endpoint->endpoint_recv_event, 0);
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
mca_btl_sctp_endpoint_dump(btl_endpoint, "accepted");
#endif
@ -650,10 +646,8 @@ void mca_btl_sctp_endpoint_close(mca_btl_base_endpoint_t* btl_endpoint)
SCTP_BTL_ERROR(("inside endpoint_close (sd = %d)\n", btl_endpoint->endpoint_sd));
if(btl_endpoint->endpoint_sd >= 0) {
opal_event.del(&btl_endpoint->endpoint_recv_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_recv_event);
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_recv_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
CLOSE_THE_SOCKET(btl_endpoint->endpoint_sd);
btl_endpoint->endpoint_sd = -1;
#if MCA_BTL_SCTP_ENDPOINT_CACHE
@ -694,7 +688,7 @@ static void mca_btl_sctp_endpoint_connected(mca_btl_base_endpoint_t* btl_endpoin
btl_endpoint->endpoint_send_frag = (mca_btl_sctp_frag_t*)
opal_list_remove_first(&btl_endpoint->endpoint_frags);
}
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
}
}
else {
@ -768,7 +762,7 @@ static void mca_btl_sctp_endpoint_connected(mca_btl_base_endpoint_t* btl_endpoin
} else {
/* no endpoint is currently associated with sending on this socket */
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
endpoint_associated_with_send = btl_endpoint;
}
}
@ -968,7 +962,7 @@ static int mca_btl_sctp_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endp
opal_socket_errno == EWOULDBLOCK)
{
btl_endpoint->endpoint_state = MCA_BTL_SCTP_CONNECTING;
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
return OMPI_SUCCESS;
}
SCTP_BTL_ERROR(("endpoint_close in start_connect #1\n"));
@ -980,7 +974,7 @@ static int mca_btl_sctp_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endp
/* send our globally unique process identifier to the endpoint */
if((rc = mca_btl_sctp_endpoint_send_connect_ack(btl_endpoint)) == OMPI_SUCCESS) {
btl_endpoint->endpoint_state = MCA_BTL_SCTP_CONNECT_ACK;
opal_event.add(&btl_endpoint->endpoint_recv_event, 0);
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
} else {
SCTP_BTL_ERROR(("endpoint_close in start_connect #2\n"));
mca_btl_sctp_endpoint_close(btl_endpoint);
@ -1028,8 +1022,7 @@ static void mca_btl_sctp_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_
opal_socklen_t so_length = sizeof(so_error);
/* unregister from receiving event notifications */
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
/* check connect completion status */
if(getsockopt(btl_endpoint->endpoint_sd, SOL_SOCKET, SO_ERROR, (char *)&so_error, &so_length) < 0) {
@ -1038,7 +1031,7 @@ static void mca_btl_sctp_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_
return;
}
if(so_error == EINPROGRESS || so_error == EWOULDBLOCK) {
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
return;
}
if(so_error != 0) {
@ -1049,7 +1042,7 @@ static void mca_btl_sctp_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_
if(mca_btl_sctp_endpoint_send_connect_ack(btl_endpoint) == OMPI_SUCCESS) {
btl_endpoint->endpoint_state = MCA_BTL_SCTP_CONNECT_ACK;
opal_event.add(&btl_endpoint->endpoint_recv_event, 0);
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
} else {
mca_btl_sctp_endpoint_close(btl_endpoint);
}
@ -1188,16 +1181,14 @@ static void mca_btl_sctp_endpoint_send_handler(int sd, short flags, void* user)
/* if nothing else to do unregister for send event notifications */
if(NULL == btl_endpoint->endpoint_send_frag) {
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
}
break;
}
default:
BTL_ERROR(("invalid connection state (%d)",
btl_endpoint->endpoint_state));
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
break;
}
OPAL_THREAD_UNLOCK(&btl_endpoint->endpoint_send_lock);
@ -1241,8 +1232,7 @@ static void mca_btl_sctp_endpoint_send_handler(int sd, short flags, void* user)
if(NULL == btl_endpoint->endpoint_send_frag && NULL == current_our_endpoint) {
/* remove the send event with this endpoint */
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
endpoint_associated_with_send = NULL;
/* see if there is another endpoint that wants the send event */
@ -1280,7 +1270,7 @@ static void mca_btl_sctp_endpoint_send_handler(int sd, short flags, void* user)
btl_endpoint = next_endpoint;
assert(btl_endpoint->endpoint_in_list > 0);
btl_endpoint->endpoint_in_list--;
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
opal_list_append(&sending_endpoints_freelist, (opal_list_item_t *) our_btl_endpoint);
endpoint_associated_with_send = btl_endpoint;
goto send_handler_1_to_many_different_endpoint;
@ -1325,8 +1315,7 @@ static void mca_btl_sctp_endpoint_send_handler(int sd, short flags, void* user)
BTL_ERROR(("invalid connection state (%d)",
btl_endpoint->endpoint_state));
/*TODO: update del code to use sending_endpoints list */
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
}
OPAL_THREAD_UNLOCK(&btl_endpoint->endpoint_send_lock);
}

View File

@ -139,7 +139,6 @@ typedef struct mca_btl_tcp_event_t mca_btl_tcp_event_t;
static void mca_btl_tcp_event_construct(mca_btl_tcp_event_t* event)
{
OPAL_THREAD_LOCK(&mca_btl_tcp_component.tcp_lock);
OBJ_CONSTRUCT(&event->event, opal_event_t);
opal_list_append(&mca_btl_tcp_component.tcp_events, &event->item);
OPAL_THREAD_UNLOCK(&mca_btl_tcp_component.tcp_lock);
}
@ -148,7 +147,6 @@ static void mca_btl_tcp_event_destruct(mca_btl_tcp_event_t* event)
{
OPAL_THREAD_LOCK(&mca_btl_tcp_component.tcp_lock);
opal_list_remove_item(&mca_btl_tcp_component.tcp_events, &event->item);
OBJ_DESTRUCT(&event->event);
OPAL_THREAD_UNLOCK(&mca_btl_tcp_component.tcp_lock);
}
@ -309,15 +307,13 @@ int mca_btl_tcp_component_close(void)
free(mca_btl_tcp_component.tcp_btls);
if (mca_btl_tcp_component.tcp_listen_sd >= 0) {
opal_event.del(&mca_btl_tcp_component.tcp_recv_event);
OBJ_DESTRUCT(&mca_btl_tcp_component.tcp_recv_event);
opal_event_del(&mca_btl_tcp_component.tcp_recv_event);
CLOSE_THE_SOCKET(mca_btl_tcp_component.tcp_listen_sd);
mca_btl_tcp_component.tcp_listen_sd = -1;
}
#if OPAL_WANT_IPV6
if (mca_btl_tcp_component.tcp6_listen_sd >= 0) {
opal_event.del(&mca_btl_tcp_component.tcp6_recv_event);
OBJ_DESTRUCT(&mca_btl_tcp_component.tcp6_recv_event);
opal_event_del(&mca_btl_tcp_component.tcp6_recv_event);
CLOSE_THE_SOCKET(mca_btl_tcp_component.tcp6_listen_sd);
mca_btl_tcp_component.tcp6_listen_sd = -1;
}
@ -331,7 +327,7 @@ int mca_btl_tcp_component_close(void)
item = next) {
mca_btl_tcp_event_t* event = (mca_btl_tcp_event_t*)item;
next = opal_list_get_next(item);
opal_event.del(&event->event);
opal_event_del(&event->event);
OBJ_RELEASE(event);
}
OPAL_THREAD_UNLOCK(&mca_btl_tcp_component.tcp_lock);
@ -798,23 +794,21 @@ static int mca_btl_tcp_component_create_listen(uint16_t af_family)
/* register listen port */
if (AF_INET == af_family) {
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_recv_event, opal_event_t);
opal_event.set(opal_event_base, &mca_btl_tcp_component.tcp_recv_event,
opal_event_set(opal_event_base, &mca_btl_tcp_component.tcp_recv_event,
mca_btl_tcp_component.tcp_listen_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_tcp_component_accept_handler,
0 );
opal_event.add(&mca_btl_tcp_component.tcp_recv_event, 0);
opal_event_add(&mca_btl_tcp_component.tcp_recv_event, 0);
}
#if OPAL_WANT_IPV6
if (AF_INET6 == af_family) {
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp6_recv_event, opal_event_t);
opal_event.set(opal_event_base, &mca_btl_tcp_component.tcp6_recv_event,
opal_event_set(opal_event_base, &mca_btl_tcp_component.tcp6_recv_event,
mca_btl_tcp_component.tcp6_listen_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_tcp_component_accept_handler,
0 );
opal_event.add(&mca_btl_tcp_component.tcp6_recv_event, 0);
opal_event_add(&mca_btl_tcp_component.tcp6_recv_event, 0);
}
#endif
return OMPI_SUCCESS;
@ -1032,8 +1026,8 @@ static void mca_btl_tcp_component_accept_handler( int incoming_sd,
/* wait for receipt of peers process identifier to complete this connection */
event = OBJ_NEW(mca_btl_tcp_event_t);
opal_event.set(opal_event_base, &event->event, sd, OPAL_EV_READ, mca_btl_tcp_component_recv_handler, event);
opal_event.add(&event->event, 0);
opal_event_set(opal_event_base, &event->event, sd, OPAL_EV_READ, mca_btl_tcp_component_recv_handler, event);
opal_event_add(&event->event, 0);
}
}

View File

@ -73,8 +73,6 @@ static void mca_btl_tcp_endpoint_construct(mca_btl_tcp_endpoint_t* endpoint)
endpoint->endpoint_sd = -1;
endpoint->endpoint_send_frag = 0;
endpoint->endpoint_recv_frag = 0;
OBJ_CONSTRUCT(&endpoint->endpoint_send_event, opal_event_t);
OBJ_CONSTRUCT(&endpoint->endpoint_recv_event, opal_event_t);
endpoint->endpoint_state = MCA_BTL_TCP_CLOSED;
endpoint->endpoint_retries = 0;
endpoint->endpoint_nbo = false;
@ -99,8 +97,6 @@ static void mca_btl_tcp_endpoint_destruct(mca_btl_tcp_endpoint_t* endpoint)
OBJ_DESTRUCT(&endpoint->endpoint_frags);
OBJ_DESTRUCT(&endpoint->endpoint_send_lock);
OBJ_DESTRUCT(&endpoint->endpoint_recv_lock);
OBJ_DESTRUCT(&endpoint->endpoint_send_event);
OBJ_DESTRUCT(&endpoint->endpoint_recv_event);
}
OBJ_CLASS_INSTANCE(
@ -214,7 +210,7 @@ static inline void mca_btl_tcp_endpoint_event_init(mca_btl_base_endpoint_t* btl_
btl_endpoint->endpoint_cache_pos = btl_endpoint->endpoint_cache;
#endif /* MCA_BTL_TCP_ENDPOINT_CACHE */
opal_event.set(opal_event_base, &btl_endpoint->endpoint_recv_event,
opal_event_set(opal_event_base, &btl_endpoint->endpoint_recv_event,
btl_endpoint->endpoint_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_tcp_endpoint_recv_handler,
@ -225,7 +221,7 @@ static inline void mca_btl_tcp_endpoint_event_init(mca_btl_base_endpoint_t* btl_
* will be fired only once, and when the endpoint is marked as
* CONNECTED the event should be recreated with the correct flags.
*/
opal_event.set(opal_event_base, &btl_endpoint->endpoint_send_event,
opal_event_set(opal_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE,
mca_btl_tcp_endpoint_send_handler,
@ -271,7 +267,7 @@ int mca_btl_tcp_endpoint_send(mca_btl_base_endpoint_t* btl_endpoint, mca_btl_tcp
return 1;
} else {
btl_endpoint->endpoint_send_frag = frag;
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
}
} else {
@ -369,7 +365,7 @@ bool mca_btl_tcp_endpoint_accept(mca_btl_base_endpoint_t* btl_endpoint,
return false;
}
mca_btl_tcp_endpoint_event_init(btl_endpoint);
opal_event.add(&btl_endpoint->endpoint_recv_event, 0);
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
mca_btl_tcp_endpoint_connected(btl_endpoint);
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
mca_btl_tcp_endpoint_dump(btl_endpoint, "accepted");
@ -395,8 +391,8 @@ void mca_btl_tcp_endpoint_close(mca_btl_base_endpoint_t* btl_endpoint)
return;
btl_endpoint->endpoint_state = MCA_BTL_TCP_CLOSED;
btl_endpoint->endpoint_retries++;
opal_event.del(&btl_endpoint->endpoint_recv_event);
opal_event.del(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_recv_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
CLOSE_THE_SOCKET(btl_endpoint->endpoint_sd);
btl_endpoint->endpoint_sd = -1;
#if MCA_BTL_TCP_ENDPOINT_CACHE
@ -420,7 +416,7 @@ static void mca_btl_tcp_endpoint_connected(mca_btl_base_endpoint_t* btl_endpoint
btl_endpoint->endpoint_retries = 0;
/* Create the send event in a persistent manner. */
opal_event.set(opal_event_base, &btl_endpoint->endpoint_send_event,
opal_event_set(opal_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE | OPAL_EV_PERSIST,
mca_btl_tcp_endpoint_send_handler,
@ -430,7 +426,7 @@ static void mca_btl_tcp_endpoint_connected(mca_btl_base_endpoint_t* btl_endpoint
if(NULL == btl_endpoint->endpoint_send_frag)
btl_endpoint->endpoint_send_frag = (mca_btl_tcp_frag_t*)
opal_list_remove_first(&btl_endpoint->endpoint_frags);
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
}
}
@ -581,7 +577,7 @@ static int mca_btl_tcp_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endpo
/* non-blocking so wait for completion */
if(opal_socket_errno == EINPROGRESS || opal_socket_errno == EWOULDBLOCK) {
btl_endpoint->endpoint_state = MCA_BTL_TCP_CONNECTING;
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
return OMPI_SUCCESS;
}
{
@ -600,7 +596,7 @@ static int mca_btl_tcp_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endpo
/* send our globally unique process identifier to the endpoint */
if((rc = mca_btl_tcp_endpoint_send_connect_ack(btl_endpoint)) == OMPI_SUCCESS) {
btl_endpoint->endpoint_state = MCA_BTL_TCP_CONNECT_ACK;
opal_event.add(&btl_endpoint->endpoint_recv_event, 0);
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
} else {
mca_btl_tcp_endpoint_close(btl_endpoint);
}
@ -622,7 +618,7 @@ static void mca_btl_tcp_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_e
mca_btl_tcp_proc_tosocks(btl_endpoint->endpoint_addr, &endpoint_addr);
/* unregister from receiving event notifications */
opal_event.del(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
/* check connect completion status */
if(getsockopt(btl_endpoint->endpoint_sd, SOL_SOCKET, SO_ERROR, (char *)&so_error, &so_length) < 0) {
@ -633,7 +629,7 @@ static void mca_btl_tcp_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_e
return;
}
if(so_error == EINPROGRESS || so_error == EWOULDBLOCK) {
opal_event.add(&btl_endpoint->endpoint_send_event, 0);
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
return;
}
if(so_error != 0) {
@ -646,7 +642,7 @@ static void mca_btl_tcp_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_e
if(mca_btl_tcp_endpoint_send_connect_ack(btl_endpoint) == OMPI_SUCCESS) {
btl_endpoint->endpoint_state = MCA_BTL_TCP_CONNECT_ACK;
opal_event.add(&btl_endpoint->endpoint_recv_event, 0);
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
} else {
mca_btl_tcp_endpoint_close(btl_endpoint);
}
@ -795,12 +791,12 @@ static void mca_btl_tcp_endpoint_send_handler(int sd, short flags, void* user)
/* if nothing else to do unregister for send event notifications */
if(NULL == btl_endpoint->endpoint_send_frag) {
opal_event.del(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
}
break;
default:
BTL_ERROR(("invalid connection state (%d)", btl_endpoint->endpoint_state));
opal_event.del(&btl_endpoint->endpoint_send_event);
opal_event_del(&btl_endpoint->endpoint_send_event);
break;
}
OPAL_THREAD_UNLOCK(&btl_endpoint->endpoint_send_lock);

View File

@ -4445,7 +4445,7 @@ static int ft_event_exchange_bookmarks(void)
/* Wait for all bookmarks to arrive */
START_TIMER(CRCP_TIMER_CKPT_EX_WAIT);
while( total_recv_bookmarks > 0 ) {
opal_event.loop(opal_event_base, OPAL_EVLOOP_NONBLOCK);
opal_event_loop(opal_event_base, OPAL_EVLOOP_NONBLOCK);
}
total_recv_bookmarks = 0;
END_TIMER(CRCP_TIMER_CKPT_EX_WAIT);
@ -5240,7 +5240,7 @@ static int wait_quiesce_drain_ack(void)
}
}
opal_event.loop(opal_event_base, OPAL_EVLOOP_NONBLOCK);
opal_event_loop(opal_event_base, OPAL_EVLOOP_NONBLOCK);
}
/* Clear the ack queue if it isn't already clear (it should already be) */

View File

@ -42,17 +42,13 @@ static void mca_pml_dr_vfrag_construct(mca_pml_dr_vfrag_t* vfrag)
vfrag->vf_ack_tv = mca_pml_dr.ack_timer;
vfrag->vf_wdog_cnt = 0;
vfrag->vf_ack_cnt = 0;
OBJ_CONSTRUCT(&vfrag->vf_wdog_ev, opal_event_t);
opal_event.evtimer_set(opal_event_base, &vfrag->vf_wdog_ev, mca_pml_dr_vfrag_wdog_timeout, (void*) vfrag);
OBJ_CONSTRUCT(&vfrag->vf_ack_ev, opal_event_t);
opal_event.evtimer_set(opal_event_base, &vfrag->vf_ack_ev, mca_pml_dr_vfrag_ack_timeout, (void*) vfrag);
opal_event_evtimer_set(opal_event_base, &vfrag->vf_wdog_ev, mca_pml_dr_vfrag_wdog_timeout, (void*) vfrag);
opal_event_evtimer_set(opal_event_base, &vfrag->vf_ack_ev, mca_pml_dr_vfrag_ack_timeout, (void*) vfrag);
}
static void mca_pml_dr_vfrag_destruct(mca_pml_dr_vfrag_t* vfrag)
{
OBJ_DESTRUCT(&vfrag->vf_wdog_ev);
OBJ_DESTRUCT(&vfrag->vf_ack_ev);
}

View File

@ -99,18 +99,18 @@ do { \
#define MCA_PML_DR_VFRAG_WDOG_START(vfrag) \
do { \
opal_event.add(&(vfrag)->vf_wdog_ev, &(vfrag)->vf_wdog_tv); \
opal_event_add(&(vfrag)->vf_wdog_ev, &(vfrag)->vf_wdog_tv); \
} while(0)
#define MCA_PML_DR_VFRAG_WDOG_STOP(vfrag) \
do { \
opal_event.del(&(vfrag)->vf_wdog_ev); \
opal_event_del(&(vfrag)->vf_wdog_ev); \
} while(0)
#define MCA_PML_DR_VFRAG_WDOG_RESET(vfrag) \
do { \
opal_event.del(&(vfrag)->vf_wdog_ev); \
opal_event.add(&(vfrag)->vf_wdog_ev, &vfrag->vf_wdog_tv); \
opal_event_del(&(vfrag)->vf_wdog_ev); \
opal_event_add(&(vfrag)->vf_wdog_ev, &vfrag->vf_wdog_tv); \
} while(0)
@ -120,12 +120,12 @@ do { \
#define MCA_PML_DR_VFRAG_ACK_START(vfrag) \
do { \
opal_event.add(&(vfrag)->vf_ack_ev, &(vfrag)->vf_ack_tv); \
opal_event_add(&(vfrag)->vf_ack_ev, &(vfrag)->vf_ack_tv); \
} while(0)
#define MCA_PML_DR_VFRAG_ACK_STOP(vfrag) \
do { \
opal_event.del(&vfrag->vf_ack_ev); \
opal_event_del(&vfrag->vf_ack_ev); \
} while(0)
#define MCA_PML_DR_VFRAG_ACK_RESET(vfrag) \

View File

@ -241,14 +241,12 @@ int main(int argc, char *argv[])
/* Set signal handlers to catch kill signals so we can properly clean up
* after ourselves.
*/
OBJ_CONSTRUCT(&term_handler, opal_event_t);
opal_event.set(opal_event_base, &term_handler, SIGTERM, OPAL_EV_SIGNAL,
opal_event_set(opal_event_base, &term_handler, SIGTERM, OPAL_EV_SIGNAL,
shutdown_callback, NULL);
opal_event.add(&term_handler, NULL);
OBJ_CONSTRUCT(&int_handler, opal_event_t);
opal_event.set(opal_event_base, &int_handler, SIGINT, OPAL_EV_SIGNAL,
opal_event_add(&term_handler, NULL);
opal_event_set(opal_event_base, &int_handler, SIGINT, OPAL_EV_SIGNAL,
shutdown_callback, NULL);
opal_event.add(&int_handler, NULL);
opal_event_add(&int_handler, NULL);
/* We actually do *not* want the server to voluntarily yield() the
processor more than necessary. The server already blocks when
@ -284,7 +282,7 @@ int main(int argc, char *argv[])
}
/* wait to hear we are done */
opal_event.dispatch(opal_event_base);
opal_event_dispatch(opal_event_base);
/* should never get here, but if we do... */

View File

@ -20,12 +20,7 @@ int opal_event_base_close(void)
opal_list_item_t *item;
/* release the event base */
OBJ_RELEASE(opal_event_base);
/* If there is a selected event module, finalize it */
if (NULL != opal_event.finalize) {
opal_event.finalize();
}
opal_event_base_finalize(opal_event_base);
/* no need to close the component as it was statically opened */

View File

@ -15,6 +15,7 @@
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/event/event.h"
#include "opal/mca/event/base/base.h"
@ -31,17 +32,12 @@
* Globals
*/
int opal_event_base_output = -1;
opal_event_module_t opal_event = {0};
opal_list_t opal_event_components;
opal_event_base_t *opal_event_base=NULL;
/*
* Only ONE event component can compile at any time, so
* just open that one - it will be statically built
*/
int opal_event_base_open(void)
{
int value, rc = OPAL_SUCCESS;
mca_base_component_list_item_t *cli;
/* Debugging / verbose output */
mca_base_param_reg_int_name("event", "base_verbose",
@ -58,72 +54,22 @@ int opal_event_base_open(void)
* to a list
*/
OBJ_CONSTRUCT(&opal_event_components, opal_list_t);
if (NULL != mca_event_base_static_components[0]) {
opal_event_component_t *component =
(opal_event_component_t*)
mca_event_base_static_components[0];
/* Save it in a global list for ompi_info */
cli = OBJ_NEW(mca_base_component_list_item_t);
cli->cli_component = mca_event_base_static_components[0];
opal_list_append(&opal_event_components,
&cli->super);
if (NULL != component->base_version.mca_open_component) {
if (OPAL_SUCCESS !=component->base_version.mca_open_component()) {
return OPAL_ERROR;
}
}
/* component will have done its duty, so close it */
if (NULL != component->base_version.mca_close_component) {
component->base_version.mca_close_component();
}
if (OPAL_SUCCESS !=
mca_base_components_open("event", 0,
mca_event_base_static_components,
&opal_event_components, true)) {
return OPAL_ERROR;
}
/* Init the final module */
if (NULL != opal_event.init) {
rc = opal_event.init();
/* init the lib */
if (OPAL_SUCCESS != (rc = opal_event_init())) {
return rc;
}
/* get our event base */
opal_event_base = OBJ_NEW(opal_event_base_t);
if (NULL == (opal_event_base = opal_event_base_create())) {
rc = OPAL_ERROR;
}
return rc;
}
/**** EVENT OBJECT ****/
static void ev_construct(opal_event_t *ptr)
{
if (NULL != opal_event.construct) {
opal_event.construct(ptr);
}
}
static void ev_destruct(opal_event_t *ptr)
{
if (NULL != opal_event.destruct) {
opal_event.destruct(ptr);
}
}
OBJ_CLASS_INSTANCE(opal_event_t,
opal_object_t,
ev_construct,
ev_destruct);
static void evbase_construct(opal_event_base_t *ptr)
{
ptr->base = NULL;
if (NULL != opal_event.construct_base) {
opal_event.construct_base(ptr);
}
}
static void evbase_destruct(opal_event_base_t *ptr)
{
if (NULL != opal_event.destruct_base) {
opal_event.destruct_base(ptr);
}
}
OBJ_CLASS_INSTANCE(opal_event_base_t,
opal_object_t,
evbase_construct,
evbase_destruct);

View File

@ -8,6 +8,17 @@ dnl
dnl $HEADER$
dnl
# There will only be one component used in this framework, and it will
# be selected at configure time by priority. Components must set
# their priorities in their configure.m4 files. They must also set
# the shell variable $event_base_include to a header file name
# (relative to the top OMPI source directory) that will be included in
# opal/mca/event/event.h. Optionally, components may also set the
# shell variable $event_base_include_cppflags if additional CPPFLAGS
# must be used with this header file. The event framework will add
# the winning component's $event_base_include_cppflags to the global
# $CPPFLAGS.
dnl We only want one winning component.
m4_define(MCA_opal_event_CONFIGURE_MODE, STOP_AT_FIRST_PRIORITY)
@ -28,7 +39,6 @@ AC_DEFUN([MCA_opal_event_CONFIG],[
# event component (for timers, etc.), but we don't have working
# event ops. Ensure that it was set by the component.
echo " "
echo HAVE_WORKING_EVENTOPS is: $OPAL_HAVE_WORKING_EVENTOPS
AC_MSG_CHECKING([if have working event ops for the event framework])
AS_IF([test "$OPAL_HAVE_WORKING_EVENTOPS" = ""],
[AC_MSG_RESULT([unknown])
@ -40,4 +50,18 @@ AC_DEFUN([MCA_opal_event_CONFIG],[
AC_DEFINE_UNQUOTED(OPAL_HAVE_WORKING_EVENTOPS,
[$OPAL_HAVE_WORKING_EVENTOPS],
[Whether our event component has working event operations or not (if not, then assumedly it only has working timers and signals)])
# someone should have set this...
AS_IF([test "$event_base_include" = ""],
[AC_MSG_WARN([Missing implementation header])
AC_MSG_ERROR([Cannot continue])])
AC_DEFINE_UNQUOTED([MCA_event_IMPLEMENTATION_HEADER],
["opal/mca/event/$event_base_include"],
[Header to include for event implementation])
AC_MSG_CHECKING([for winning component additional CPPFLAGS])
AS_IF([test "$event_base_include_cppflags" != ""],
[AC_MSG_RESULT([$event_base_include_cppflags])
CPPFLAGS="$CPPFLAGS $event_base_include_cppflags -DGOT_EVENT_BASE_INCLUDE_CPPFLAGS"],
[AC_MSG_RESULT([none])])
])

View File

@ -2,12 +2,9 @@
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* The OPAL interface into the Libevent library. Contains a number
* of renamings for use inside OPAL, and some customized wrapper functions
*
* NOTE: OPAL functions currently point to deprecated libevent interfaces!
*
* @file opal_event.h
* $COPYRIGHT$
*
* Additional copyrights may follow
*/
#ifndef OPAL_MCA_EVENT_H
@ -30,8 +27,6 @@
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/class/opal_object.h"
#include "opal/class/opal_list.h"
BEGIN_C_DECLS
@ -43,111 +38,10 @@ typedef unsigned char u_char;
typedef unsigned short u_short;
#endif
#define OPAL_EV_TIMEOUT 0x01
#define OPAL_EV_READ 0x02
#define OPAL_EV_WRITE 0x04
#define OPAL_EV_SIGNAL 0x08
/* Persistent event: won't get removed automatically when activated. */
#define OPAL_EV_PERSIST 0x10
#define OPAL_EVENT_SIGNAL(ev) opal_event.get_signal(ev)
#define OPAL_EVLOOP_ONCE 0x01 /**< Block at most once. */
#define OPAL_EVLOOP_NONBLOCK 0x02 /**< Do not block. */
/* selected module will fill this typedef in with their
* own definition of ev_struct
*/
typedef struct {
opal_object_t super;
void *event;
} opal_event_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_event_t);
typedef struct {
opal_object_t super;
void *base;
} opal_event_base_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_event_base_t);
#define OPAL_EVENT_SIGNAL(ev) opal_event_get_signal(ev)
#define OPAL_TIMEOUT_DEFAULT {1, 0}
typedef void (*opal_event_callback_fn_t)(int, short, void *);
typedef int (*opal_event_base_module_init_fn_t)(void);
typedef int (*opal_event_base_module_fini_fn_t)(void);
typedef void (*opal_event_base_module_set_debug_output_fn_t)(bool output);
typedef int (*opal_event_base_module_set_fn_t)(opal_event_base_t *evbase,
opal_event_t *ev, int fd, short events,
opal_event_callback_fn_t cbfunc, void *arg);
typedef int (*opal_event_base_module_add_fn_t)(opal_event_t *ev, const struct timeval *tv);
typedef int (*opal_event_base_module_del_fn_t)(opal_event_t *ev);
typedef int (*opal_event_base_module_get_signal_fn_t)(opal_event_t *ev);
typedef int (*opal_event_base_module_dispatch_fn_t)(opal_event_base_t *evbase);
/**
Create a timer event
*/
typedef opal_event_t* (*opal_event_base_module_evtimer_new_fn_t)(opal_event_base_t *evbase,
opal_event_callback_fn_t cbfunc,
void *cbdata);
/**
Add a timer event.
@param ev the event struct
@param tv timeval struct
*/
typedef int (*opal_event_base_module_evtimer_add_fn_t)(opal_event_t *ev, const struct timeval *tv);
/**
Define a timer event.
@param ev event struct to be modified
@param cb callback function
@param arg argument that will be passed to the callback function
*/
typedef void (*opal_event_base_module_evtimer_set_fn_t)(opal_event_base_t *evbase,
opal_event_t *ev,
opal_event_callback_fn_t cbfunc, void *cbdata);
/**
* Delete a timer event.
*
* @param ev the event struct to be disabled
*/
typedef int (*opal_event_base_module_evtimer_del_fn_t)(opal_event_t *ev);
typedef int (*opal_event_base_module_evtimer_pending_fn_t)(opal_event_t *ev, struct timeval *tv);
typedef int (*opal_event_base_module_evtimer_initialized_fn_t)(opal_event_t *ev);
typedef int (*opal_event_base_module_signal_add_fn_t)(opal_event_t *ev, struct timeval *tv);
typedef int (*opal_event_base_module_signal_set_fn_t)(opal_event_base_t *evbase,
opal_event_t *ev, int fd,
opal_event_callback_fn_t cbfunc, void *cbdata);
typedef int (*opal_event_base_module_signal_del_fn_t)(opal_event_t *ev);
typedef int (*opal_event_base_module_signal_pending_fn_t)(opal_event_t *ev, struct timeval *tv);
typedef int (*opal_event_base_module_signal_initialized_fn_t)(opal_event_t *ev);
typedef int (*opal_event_base_module_loop_fn_t)(opal_event_base_t *evbase, int flags);
/* construct/destruct the event struct hidden inside the opal_event_t object */
typedef void (*opal_event_base_module_construct_fn_t)(opal_event_t *ev);
typedef void (*opal_event_base_module_destruct_fn_t)(opal_event_t *ev);
/* construct/destruct the event base hidden inside the opal_event_base_t object */
typedef void (*opal_event_base_construct_base_fn_t)(opal_event_base_t *evbase);
typedef void (*opal_event_base_destruct_base_fn_t)(opal_event_base_t *evbase);
/* This is to prevent event library from picking up the win32_ops
since this will be picked up over select(). By using select, we can
@ -174,45 +68,6 @@ struct opal_event_base_component_2_0_0_t {
typedef struct opal_event_base_component_2_0_0_t opal_event_base_component_2_0_0_t;
typedef struct opal_event_base_component_2_0_0_t opal_event_component_t;
/**
* Structure for event API
*/
struct opal_event_base_module_1_0_0_t {
/* constructor/destructor needed for event struct */
opal_event_base_module_construct_fn_t construct;
opal_event_base_module_destruct_fn_t destruct;
/* constructor/destructor needed for event_base struct */
opal_event_base_construct_base_fn_t construct_base;
opal_event_base_destruct_base_fn_t destruct_base;
/* all API functions */
opal_event_base_module_init_fn_t init;
opal_event_base_module_fini_fn_t finalize;
opal_event_base_module_set_debug_output_fn_t set_debug_output;
opal_event_base_module_set_fn_t set;
opal_event_base_module_add_fn_t add;
opal_event_base_module_del_fn_t del;
opal_event_base_module_get_signal_fn_t get_signal;
opal_event_base_module_dispatch_fn_t dispatch;
opal_event_base_module_evtimer_new_fn_t evtimer_new;
opal_event_base_module_evtimer_add_fn_t evtimer_add;
opal_event_base_module_evtimer_set_fn_t evtimer_set;
opal_event_base_module_evtimer_del_fn_t evtimer_del;
opal_event_base_module_evtimer_pending_fn_t evtimer_pending;
opal_event_base_module_evtimer_initialized_fn_t evtimer_initialized;
opal_event_base_module_signal_add_fn_t signal_add;
opal_event_base_module_signal_set_fn_t signal_set;
opal_event_base_module_signal_del_fn_t signal_del;
opal_event_base_module_signal_pending_fn_t signal_pending;
opal_event_base_module_signal_initialized_fn_t signal_initialized;
opal_event_base_module_loop_fn_t loop;
};
/**
* Convenience typedef
*/
typedef struct opal_event_base_module_1_0_0_t opal_event_base_module_1_0_0_t;
typedef struct opal_event_base_module_1_0_0_t opal_event_module_t;
/**
* Macro for use in components that are of type event
*/
@ -220,11 +75,9 @@ typedef struct opal_event_base_module_1_0_0_t opal_event_module_t;
MCA_BASE_VERSION_2_0_0, \
"event", 2, 0, 0
/* Global structure for accessing event functions */
OPAL_DECLSPEC extern opal_event_module_t opal_event;
OPAL_DECLSPEC extern opal_event_base_t *opal_event_base;
END_C_DECLS
/* include implementation to call */
#include MCA_event_IMPLEMENTATION_HEADER
#endif /* OPAL_EVENT_H_ */

View File

@ -13,11 +13,18 @@ AM_CPPFLAGS = -I$(srcdir)/libevent -I$(srcdir)/libevent/include -I$(builddir)/li
SUBDIRS = libevent
headers = libevent207.h
sources = \
libevent207.h \
libevent207_component.c \
libevent207_module.c
# Conditionally install the header files
if WANT_INSTALL_HEADERS
opaldir = $(includedir)/openmpi/$(subdir)
nobase_opal_HEADERS = $(headers)
endif
# Make the output library in this directory, and name it either
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
# (for static builds).

View File

@ -19,11 +19,12 @@ AC_DEFUN([MCA_opal_event_libevent207_COMPILE_MODE], [
AC_MSG_RESULT([$$4])
])
# MCA_event_libevent207_CONFIG(action-if-can-compile,
# [action-if-cant-compile])
# MCA_event_libevent207_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_opal_event_libevent207_CONFIG],[
AC_CONFIG_FILES([opal/mca/event/libevent207/Makefile])
basedir="opal/mca/event/libevent207"
CFLAGS_save="$CFLAGS"
CFLAGS="$OMPI_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"
@ -32,7 +33,7 @@ AC_DEFUN([MCA_opal_event_libevent207_CONFIG],[
AC_MSG_CHECKING([libevent configuration args])
str=`event_args="--disable-dns --disable-http --disable-rpc --disable-openssl --enable-hidden-symbols --disable-thread-support --includedir=$includedir/openmpi/opal/event/libevent/include"`
str=`event_args="--disable-dns --disable-http --disable-rpc --disable-openssl --enable-hidden-symbols --includedir=$includedir/openmpi/opal/event/libevent/include"`
eval $str
unset str
@ -93,9 +94,15 @@ AC_DEFUN([MCA_opal_event_libevent207_CONFIG],[
event_args="$event_args --disable-debug-mode"
fi
AC_ARG_ENABLE(event-thread-support,
AC_HELP_STRING([--enable-event-thread-support], [enable event library internal thread support]))
if test "$enable_event_thread_support" = "no"; then
event_args="$event_args --disable-thread-support"
fi
AC_MSG_RESULT([$event_args])
OMPI_CONFIG_SUBDIR(opal/mca/event/libevent207/libevent,
OMPI_CONFIG_SUBDIR([$basedir/libevent],