1
1

Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.

This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.

Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.

Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.

I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:

1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)

2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.

There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.

This commit was SVN r23925.
Этот коммит содержится в:
Ralph Castain 2010-10-24 18:35:54 +00:00
родитель 082086085b
Коммит fceabb2498
390 изменённых файлов: 64531 добавлений и 23871 удалений

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

@ -135,12 +135,15 @@ m4_ifdef([project_orte],
AC_SUBST(libopen_pal_so_version)
#
# Hardwire OPAL progress threads to be off
# Hardwire all progress threads to be off
#
OPAL_ENABLE_PROGRESS_THREADS=0
enable_progress_threads="no"
AC_DEFINE_UNQUOTED([OPAL_ENABLE_PROGRESS_THREADS], [$OPAL_ENABLE_PROGRESS_THREADS],
[Hardcode the OPAL progress thread to be off])
ORTE_ENABLE_PROGRESS_THREADS=0
AC_DEFINE_UNQUOTED([ORTE_ENABLE_PROGRESS_THREADS], [$ORTE_ENABLE_PROGRESS_THREADS],
[Hardcode the ORTE progress thread to be off])
OMPI_ENABLE_PROGRESS_THREADS=0
AC_DEFINE_UNQUOTED([OMPI_ENABLE_PROGRESS_THREADS], [$OMPI_ENABLE_PROGRESS_THREADS],
[Hardcode the OMPI progress thread to be off])
# List header files to generate
@ -564,7 +567,7 @@ AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h \
stdarg.h sys/stat.h sys/statfs.h sys/statvfs.h sys/time.h sys/tree.h \
sys/types.h sys/uio.h net/uio.h sys/utsname.h sys/vfs.h sys/wait.h syslog.h \
time.h termios.h ulimit.h unistd.h util.h utmp.h malloc.h \
ifaddrs.h sys/sysctl.h crt_externs.h regex.h \
ifaddrs.h sys/sysctl.h crt_externs.h regex.h signal.h \
ioLib.h sockLib.h hostLib.h shlwapi.h sys/synch.h limits.h db.h ndbm.h])
# Needed to work around Darwin requiring sys/socket.h for
@ -1019,17 +1022,6 @@ OPAL_CHECK_VISIBILITY
ompi_show_title "Final top-level OMPI configuration"
############################################################################
# Libevent setup
############################################################################
ompi_show_subtitle "Libevent 3rd party event handler"
CFLAGS_save="$CFLAGS"
CFLAGS="$OMPI_CFLAGS_BEFORE_PICKY"
OPAL_SETUP_LIBEVENT
CFLAGS="$CFLAGS_save"
############################################################################
# Libtool: part two
# (after C compiler setup = no compiler/linker tests after this)

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

@ -18,7 +18,7 @@
*/
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "mpi.h"
#include "ompi/mca/bml/bml.h"
#include "ompi/mca/btl/base/base.h"

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

@ -170,7 +170,7 @@ int mca_bml_r2_ft_event(int state)
* This will cause the BTL components to discover the available
* network options on this machine, and post proper modex informaiton.
*/
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OPAL_ENABLE_PROGRESS_THREADS,
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE) ) ) {
opal_output(0, "bml:r2: ft_event(Restart): Failed to select in BTL framework\n");
return ret;
@ -266,7 +266,7 @@ int mca_bml_r2_ft_event(int state)
* This will cause the BTL components to discover the available
* network options on this machine, and post proper modex informaiton.
*/
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OPAL_ENABLE_PROGRESS_THREADS,
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE) ) ) {
opal_output(0, "bml:r2: ft_event(Restart): Failed to select in BTL framework\n");
return ret;

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

@ -22,7 +22,7 @@
#include <stdio.h>
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "ompi/mca/btl/base/base.h"
@ -38,7 +38,7 @@ int mca_btl_base_close(void)
return OMPI_SUCCESS;
}
/* disable event processing while cleaning up btls */
opal_event_disable();
opal_event.disable();
/* Finalize all the btl components and free their list items */
@ -70,7 +70,7 @@ int mca_btl_base_close(void)
free(mca_btl_base_exclude);
/* restore event processing */
opal_event_enable();
opal_event.enable();
/* All done */
return OMPI_SUCCESS;

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

@ -17,7 +17,7 @@
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/btl_base_error.h"

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

@ -12,7 +12,7 @@
#include "ompi_config.h"
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "ompi/mca/btl/btl.h"

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

@ -13,7 +13,7 @@
#define MCA_BTL_ELAN_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "btl_elan_frag.h"
#include "btl_elan.h"

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

@ -75,7 +75,7 @@ mca_btl_gm_module_t mca_btl_gm_module = {
mca_btl_gm_free,
mca_btl_gm_prepare_src,
mca_btl_gm_prepare_dst,
#if OMPI_ENABLE_THREAD_MULTIPLE || OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_THREAD_MULTIPLE || OMPI_ENABLE_PROGRESS_THREADS
mca_btl_gm_send,
NULL, /* send immediate */
mca_btl_gm_put,
@ -939,14 +939,14 @@ int mca_btl_gm_get(
* Cleanup/release module resources.
*/
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
static void mca_btl_gm_alarm(void* arg) {}
#endif
int mca_btl_gm_finalize(struct mca_btl_base_module_t* btl)
{
mca_btl_gm_module_t* gm_btl = (mca_btl_gm_module_t*) btl;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
gm_alarm_t alarm;
OPAL_THREAD_LOCK(&mca_btl_gm_component.gm_lock);
gm_btl->gm_progress = false;

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

@ -28,7 +28,7 @@
#include <gm.h>
/* Open MPI includes */
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
@ -97,7 +97,7 @@ struct mca_btl_gm_module_t {
opal_list_t gm_pending; /**< list of pending send descriptors */
opal_list_t gm_repost; /**< list of pending fragments */
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
opal_thread_t gm_thread;
bool gm_progress;
#endif

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

@ -20,7 +20,7 @@
#include "ompi_config.h"
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "ompi/mca/btl/btl.h"
@ -43,7 +43,7 @@
#include "ompi/runtime/mpiruntime.h"
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
static void* mca_btl_gm_progress_thread( opal_object_t* arg );
#endif
static int gm_reg_mr(void *reg_data, void *base, size_t size,
@ -234,7 +234,7 @@ mca_btl_gm_module_init (mca_btl_gm_module_t * btl)
OBJ_CONSTRUCT(&btl->gm_frag_user, ompi_free_list_t);
OBJ_CONSTRUCT(&btl->gm_pending, opal_list_t);
OBJ_CONSTRUCT(&btl->gm_repost, opal_list_t);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
OBJ_CONSTRUCT(&btl->gm_thread, opal_thread_t);
#endif
@ -341,7 +341,7 @@ mca_btl_gm_module_init (mca_btl_gm_module_t * btl)
return OMPI_ERROR;
}
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
/* start progress thread */
btl->gm_progress = true;
btl->gm_thread.t_run = mca_btl_gm_progress_thread;
@ -649,7 +649,7 @@ int mca_btl_gm_component_progress()
}
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
static void* mca_btl_gm_progress_thread( opal_object_t* arg )
{
opal_thread_t* thread = (opal_thread_t*)arg;
@ -664,9 +664,9 @@ static void* mca_btl_gm_progress_thread( opal_object_t* arg )
gm_recv_event_t* event;
/* dont process events while the app is in the library */
while(opal_progress_threads()) {
while(ompi_progress_threads()) {
OPAL_THREAD_UNLOCK(&mca_btl_gm_component.gm_lock);
while(opal_progress_threads())
while(ompi_progress_threads())
sched_yield();
usleep(100); /* give app a chance to re-enter library */
OPAL_THREAD_LOCK(&mca_btl_gm_component.gm_lock);

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

@ -20,7 +20,7 @@
#define MCA_BTL_GM_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "btl_gm_frag.h"
#include "btl_gm.h"

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

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

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

@ -20,7 +20,7 @@
#define MCA_BTL_MX_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "btl_mx_frag.h"
#include "btl_mx.h"

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

@ -24,7 +24,7 @@
#include <infiniband/verbs.h>
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "btl_ofud.h"
#include "btl_ofud_frag.h"

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

@ -176,7 +176,7 @@ static int adjust_cq(mca_btl_openib_device_t *device, const int cq)
if(NULL == device->ib_cq[cq]) {
device->ib_cq[cq] = create_cq_compat(device->ib_dev_context, cq_size,
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
device, device->ib_channel,
#else
NULL, NULL,
@ -189,7 +189,7 @@ static int adjust_cq(mca_btl_openib_device_t *device, const int cq)
return OMPI_ERROR;
}
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
if(ibv_req_notify_cq(device->ib_cq[cq], 0)) {
mca_btl_openib_show_init_error(__FILE__, __LINE__,
"ibv_req_notify_cq",

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

@ -38,7 +38,7 @@
#include "opal/class/opal_pointer_array.h"
#include "opal/class/opal_hash_table.h"
#include "opal/util/output.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/threads/threads.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/mpool/mpool.h"
@ -339,7 +339,7 @@ struct mca_btl_base_endpoint_t;
typedef struct mca_btl_openib_device_t {
opal_object_t super;
struct ibv_device *ib_dev; /* the ib device */
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
struct ibv_comp_channel *ib_channel; /* Channel event for the device */
opal_thread_t thread; /* Progress thread */
volatile bool progress; /* Progress status */
@ -466,7 +466,7 @@ struct mca_btl_openib_reg_t {
};
typedef struct mca_btl_openib_reg_t mca_btl_openib_reg_t;
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
extern void* mca_btl_openib_progress_thread(opal_object_t*);
#endif

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

@ -47,7 +47,7 @@ const char *ibv_get_sysfs_path(void);
#include <malloc.h>
#include <stddef.h>
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/align.h"
#include "opal/util/output.h"
#include "opal/util/argv.h"
@ -822,7 +822,7 @@ static void device_construct(mca_btl_openib_device_t *device)
device->ib_dev_context = NULL;
device->ib_pd = NULL;
device->mpool = NULL;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
device->ib_channel = NULL;
#endif
device->btls = 0;
@ -856,7 +856,7 @@ static void device_destruct(mca_btl_openib_device_t *device)
int i;
#if OPAL_HAVE_THREADS
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
if(device->progress) {
device->progress = false;
if (pthread_cancel(device->thread.t_handle)) {
@ -984,7 +984,7 @@ static int prepare_device_for_use(mca_btl_openib_device_t *device)
return OMPI_ERROR;
}
}
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
/* Prepare data for thread, but not starting it */
OBJ_CONSTRUCT(&device->thread, opal_thread_t);
device->thread.t_run = mca_btl_openib_progress_thread;
@ -1750,7 +1750,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
device->use_eager_rdma = values.use_eager_rdma;
}
/* Eager RDMA is not currently supported with progress threads */
if (device->use_eager_rdma && OPAL_ENABLE_PROGRESS_THREADS) {
if (device->use_eager_rdma && OMPI_ENABLE_PROGRESS_THREADS) {
device->use_eager_rdma = 0;
orte_show_help("help-mpi-btl-openib.txt",
"eager RDMA and progress threads", true);
@ -1769,7 +1769,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
goto error;
}
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
device->ib_channel = ibv_create_comp_channel(device->ib_dev_context);
if (NULL == device->ib_channel) {
BTL_ERROR(("error creating channel for %s errno says %s",
@ -2145,7 +2145,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
}
error:
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
if (device->ib_channel) {
ibv_destroy_comp_channel(device->ib_channel);
}
@ -3420,7 +3420,7 @@ error:
return count;
}
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
void* mca_btl_openib_progress_thread(opal_object_t* arg)
{
opal_thread_t* thread = (opal_thread_t*)arg;
@ -3435,8 +3435,8 @@ void* mca_btl_openib_progress_thread(opal_object_t* arg)
opal_output(-1, "WARNING: the openib btl progress thread code *does not yet work*. Your run is likely to hang, crash, break the kitchen sink, and/or eat your cat. You have been warned.");
while (device->progress) {
while(opal_progress_threads()) {
while(opal_progress_threads())
while(ompi_progress_threads()) {
while(ompi_progress_threads())
sched_yield();
usleep(100); /* give app a chance to re-enter library */
}

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

@ -26,7 +26,7 @@
#define MCA_BTL_IB_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "ompi/mca/btl/btl.h"
#include "btl_openib.h"

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

@ -34,7 +34,7 @@
#include <errno.h>
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "opal/util/fd.h"
@ -174,11 +174,11 @@ 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;
memset(&ri->ri_event, 0, sizeof(ri->ri_event));
opal_event_set(&ri->ri_event, ri->ri_fd,
OBJ_CONSTRUCT(&ri->ri_event, opal_event_t);
opal_event.set(&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,7 +237,8 @@ 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);
opal_event.del(&ri->ri_event);
OBJ_DESTRUCT(&ri->ri_event);
} else {
/* Remove this item from the fd_sets and recalculate
MAX_FD */
@ -481,17 +482,17 @@ int ompi_btl_openib_fd_init(void)
/* Create a libevent event that is used in the main thread
to watch its pipe */
memset(&main_thread_event, 0, sizeof(main_thread_event));
opal_event_set(&main_thread_event, pipe_to_main_thread[0],
OBJ_CONSTRUCT(&main_thread_event, opal_event_t);
opal_event.set(&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]);
@ -663,7 +664,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);
@ -671,8 +672,9 @@ int ompi_btl_openib_fd_finalize(void)
pthread_join(thread, NULL);
opal_atomic_rmb();
opal_event_del(&main_thread_event);
opal_event.del(&main_thread_event);
OBJ_DESTRUCT(&main_thread_event);
close(pipe_to_service_thread[0]);
close(pipe_to_service_thread[1]);
close(pipe_to_main_thread[0]);

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

@ -261,7 +261,7 @@
#include "opal/util/output.h"
#include "opal/util/error.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal_stdint.h"
#include "orte/util/show_help.h"

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

@ -33,7 +33,7 @@
#endif
/* Open MPI includes */
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"

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

@ -45,7 +45,7 @@
#endif
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/if.h"
#include "opal/util/argv.h"
#include "ompi/mca/btl/btl.h"
@ -138,6 +138,7 @@ 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);
}
@ -146,6 +147,7 @@ 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);
}
@ -287,7 +289,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);
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;
}
@ -299,7 +301,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);
@ -600,13 +602,13 @@ static int mca_btl_sctp_component_create_listen(void)
/* register listen port */
opal_event_set(
opal_event.set(
&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;
}
@ -650,13 +652,13 @@ static int mca_btl_sctp_component_register_listen(void)
/* register listen port */
opal_event_set(
opal_event.set(
&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;
}
@ -891,8 +893,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(&event->event, sd, OPAL_EV_READ, mca_btl_sctp_component_recv_handler, event);
opal_event_add(&event->event, 0);
opal_event.set(&event->event, sd, OPAL_EV_READ, mca_btl_sctp_component_recv_handler, event);
opal_event.add(&event->event, 0);
}
}
@ -911,8 +913,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(&event->event, sd, OPAL_EV_READ, mca_btl_sctp_recv_handler, event);
opal_event_add(&event->event, 0);
opal_event.set(&event->event, sd, OPAL_EV_READ, mca_btl_sctp_recv_handler, event);
opal_event.add(&event->event, 0);
}
}

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

@ -56,6 +56,9 @@
#include "ompi/types.h"
#include "ompi/mca/btl/base/btl_base_error.h"
#include "opal/mca/event/event.h"
#include "orte/util/name_fns.h"
#include "btl_sctp.h"
#include "btl_sctp_endpoint.h"
@ -106,8 +109,8 @@ 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;
endpoint->endpoint_send_event.ev_flags = 0;
endpoint->endpoint_recv_event.ev_flags = 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;
@ -179,6 +182,8 @@ 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(
@ -268,12 +273,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( &btl_endpoint->endpoint_recv_event,
opal_event.set( &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( &btl_endpoint->endpoint_send_event,
opal_event.set( &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE|OPAL_EV_PERSIST,
mca_btl_sctp_endpoint_send_handler,
@ -292,12 +297,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( &btl_endpoint->endpoint_recv_event,
opal_event.set( &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( &btl_endpoint->endpoint_send_event,
opal_event.set( &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE|OPAL_EV_PERSIST,
mca_btl_sctp_endpoint_send_handler,
@ -348,7 +353,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);
@ -454,7 +459,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;
}
}
@ -594,7 +599,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");
@ -619,7 +624,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
@ -645,8 +650,10 @@ 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);
opal_event_del(&btl_endpoint->endpoint_send_event);
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);
CLOSE_THE_SOCKET(btl_endpoint->endpoint_sd);
btl_endpoint->endpoint_sd = -1;
#if MCA_BTL_SCTP_ENDPOINT_CACHE
@ -687,7 +694,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 {
@ -761,7 +768,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;
}
}
@ -961,7 +968,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"));
@ -973,7 +980,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);
@ -1021,7 +1028,8 @@ 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);
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&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) {
@ -1030,7 +1038,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) {
@ -1041,7 +1049,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);
}
@ -1180,14 +1188,16 @@ 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);
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&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);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
break;
}
OPAL_THREAD_UNLOCK(&btl_endpoint->endpoint_send_lock);
@ -1231,7 +1241,8 @@ 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);
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
endpoint_associated_with_send = NULL;
/* see if there is another endpoint that wants the send event */
@ -1269,7 +1280,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;
@ -1314,7 +1325,8 @@ 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);
opal_event.del(&btl_endpoint->endpoint_send_event);
OBJ_DESTRUCT(&btl_endpoint->endpoint_send_event);
}
OPAL_THREAD_UNLOCK(&btl_endpoint->endpoint_send_lock);
}

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

@ -20,7 +20,7 @@
#define MCA_BTL_SCTP_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "btl_sctp_frag.h"
#include "btl_sctp.h"
BEGIN_C_DECLS

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

@ -37,7 +37,7 @@
#endif
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/mca/base/mca_base_param.h"
#include "ompi/mca/mpool/base/base.h"

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

@ -29,7 +29,7 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"

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

@ -29,7 +29,7 @@
#include "ompi/constants.h"
#include "opal/runtime/opal.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/mca/base/mca_base_param.h"
#include "btl_self.h"
#include "btl_self_frag.h"

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

@ -21,8 +21,8 @@
#ifndef MCA_BTL_SELF_ENDPOINT_H
#define MCA_BTL_SELF_ENDPOINT_H
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#include "opal/event/event.h"
#if OMPI_ENABLE_PROGRESS_THREADS == 1
#include "opal/mca/event/event.h"
#endif
/**

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

@ -392,7 +392,7 @@ static struct mca_btl_base_endpoint_t *
create_sm_endpoint(int local_proc, struct ompi_proc_t *proc)
{
struct mca_btl_base_endpoint_t *ep;
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
char path[PATH_MAX];
#endif
@ -403,7 +403,7 @@ create_sm_endpoint(int local_proc, struct ompi_proc_t *proc)
ep->peer_smp_rank = local_proc + mca_btl_sm_component.num_smp_procs;
OBJ_CONSTRUCT(&ep->pending_sends, opal_list_t);
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
sprintf(path, "%s"OPAL_PATH_SEP"sm_fifo.%lu",
orte_process_info.job_session_dir,
(unsigned long)proc->proc_name.vpid);

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

@ -62,7 +62,7 @@
#endif /* HAVE_UNISTD_H */
#include "opal/class/opal_free_list.h"
#include "ompi/class/ompi_free_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/threads/threads.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"
@ -137,7 +137,7 @@ typedef struct sm_fifo_t sm_fifo_t;
* Shared Memory resource managment
*/
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
#define DATA (char)0
#define DONE (char)1
#endif
@ -195,7 +195,7 @@ struct mca_btl_sm_component_t {
int mem_node;
int num_mem_nodes;
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
char sm_fifo_path[PATH_MAX]; /**< path to fifo used to signal this process */
int sm_fifo_fd; /**< file descriptor corresponding to opened fifo */
opal_thread_t sm_fifo_thread;
@ -556,11 +556,11 @@ extern struct mca_btl_base_descriptor_t* mca_btl_sm_prepare_dst(
*/
int mca_btl_sm_ft_event(int state);
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
void mca_btl_sm_component_event_thread(opal_object_t*);
#endif
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
#define MCA_BTL_SM_SIGNAL_PEER(peer) \
{ \
unsigned char cmd = DATA; \

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

@ -41,7 +41,7 @@
#endif /* HAVE_SYS_STAT_H */
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "orte/util/proc_info.h"
#include "orte/util/show_help.h"
@ -317,7 +317,7 @@ static int mca_btl_sm_component_close(void)
OBJ_RELEASE(mca_btl_sm_component.sm_seg);
}
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
/* close/cleanup fifo create for event notification */
if(mca_btl_sm_component.sm_fifo_fd > 0) {
/* write a done message down the pipe */
@ -367,7 +367,7 @@ static mca_btl_base_module_t** mca_btl_sm_component_init(
mca_btl_sm_component.sm_mpool = NULL;
mca_btl_sm_component.sm_mpool_base = NULL;
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
/* create a named pipe to receive events */
sprintf( mca_btl_sm_component.sm_fifo_path,
"%s"OPAL_PATH_SEP"sm_fifo.%lu", orte_process_info.job_session_dir,
@ -542,7 +542,7 @@ static mca_btl_base_module_t** mca_btl_sm_component_init(
* SM component progress.
*/
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
void mca_btl_sm_component_event_thread(opal_object_t* thread)
{
while(1) {

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

@ -22,8 +22,8 @@
#ifndef MCA_BTL_SM_ENDPOINT_H
#define MCA_BTL_SM_ENDPOINT_H
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#include "opal/event/event.h"
#if OMPI_ENABLE_PROGRESS_THREADS == 1
#include "opal/mca/event/event.h"
#endif
/**
@ -37,7 +37,7 @@ struct mca_btl_base_endpoint_t {
* SMP specfic data structures. */
int peer_smp_rank; /**< My peer's SMP process rank. Used for accessing
* SMP specfic data structures. */
#if OPAL_ENABLE_PROGRESS_THREADS == 1
#if OMPI_ENABLE_PROGRESS_THREADS == 1
int fifo_fd; /**< pipe/fifo used to signal endpoint that data is queued */
#endif
opal_list_t pending_sends; /**< pending data to send */

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

@ -34,7 +34,7 @@
#endif
/* Open MPI includes */
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"

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

@ -49,7 +49,7 @@
#include <limits.h>
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/if.h"
#include "opal/util/output.h"
#include "opal/util/argv.h"
@ -139,6 +139,7 @@ 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);
}
@ -147,6 +148,7 @@ 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);
}
@ -307,13 +309,15 @@ 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);
opal_event.del(&mca_btl_tcp_component.tcp_recv_event);
OBJ_DESTRUCT(&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);
opal_event.del(&mca_btl_tcp_component.tcp6_recv_event);
OBJ_DESTRUCT(&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;
}
@ -327,7 +331,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);
@ -794,21 +798,23 @@ static int mca_btl_tcp_component_create_listen(uint16_t af_family)
/* register listen port */
if (AF_INET == af_family) {
opal_event_set( &mca_btl_tcp_component.tcp_recv_event,
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_recv_event, opal_event_t);
opal_event.set( &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) {
opal_event_set( &mca_btl_tcp_component.tcp6_recv_event,
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp6_recv_event, opal_event_t);
opal_event.set( &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;
@ -1026,8 +1032,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(&event->event, sd, OPAL_EV_READ, mca_btl_tcp_component_recv_handler, event);
opal_event_add(&event->event, 0);
opal_event.set(&event->event, sd, OPAL_EV_READ, mca_btl_tcp_component_recv_handler, event);
opal_event.add(&event->event, 0);
}
}

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

@ -48,6 +48,8 @@
#include <time.h>
#endif /* HAVE_TIME_H */
#include "opal/mca/event/event.h"
#include "ompi/types.h"
#include "ompi/mca/btl/base/btl_base_error.h"
#include "opal/util/net.h"
@ -71,8 +73,8 @@ 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;
endpoint->endpoint_send_event.ev_flags = 0;
endpoint->endpoint_recv_event.ev_flags = 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;
@ -97,6 +99,8 @@ 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(
@ -210,7 +214,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( &btl_endpoint->endpoint_recv_event,
opal_event.set( &btl_endpoint->endpoint_recv_event,
btl_endpoint->endpoint_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_tcp_endpoint_recv_handler,
@ -221,7 +225,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( &btl_endpoint->endpoint_send_event,
opal_event.set( &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE,
mca_btl_tcp_endpoint_send_handler,
@ -267,7 +271,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 {
@ -365,7 +369,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");
@ -391,8 +395,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
@ -416,7 +420,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( &btl_endpoint->endpoint_send_event,
opal_event.set( &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE | OPAL_EV_PERSIST,
mca_btl_tcp_endpoint_send_handler,
@ -426,7 +430,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);
}
}
@ -577,7 +581,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;
}
{
@ -596,7 +600,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);
}
@ -618,7 +622,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) {
@ -629,7 +633,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) {
@ -642,7 +646,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);
}
@ -791,12 +795,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);

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

@ -20,7 +20,7 @@
#define MCA_BTL_TCP_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "btl_tcp_frag.h"
#include "btl_tcp.h"
BEGIN_C_DECLS

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

@ -26,7 +26,7 @@
#include <string.h>
/* Open MPI includes */
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"

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

@ -19,7 +19,7 @@
#include "ompi_config.h"
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/mca/btl/btl.h"
#include "opal/mca/base/mca_base_param.h"

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

@ -20,7 +20,7 @@
#define MCA_BTL_TEMPLATE_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "btl_template_frag.h"
#include "btl_template.h"
BEGIN_C_DECLS

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

@ -32,7 +32,7 @@
/* Open MPI includes */
#include "opal/class/opal_pointer_array.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/btl/btl.h"
#include "ompi/mca/btl/base/base.h"

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

@ -25,7 +25,7 @@
#include "ompi_config.h"
#include "ompi/constants.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/argv.h"
#include "ompi/mca/btl/btl.h"

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

@ -24,7 +24,7 @@
#define MCA_BTL_UDAPL_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/mca/btl/base/btl_base_error.h"
#include "btl_udapl_frag.h"
#include "btl_udapl.h"

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

@ -22,7 +22,7 @@
#endif /* HAVE_UNIST_H */
#include "opal/class/opal_bitmap.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/opal_environ.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/mca.h"

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

@ -23,7 +23,7 @@
#endif /* HAVE_UNIST_H */
#include "opal/runtime/opal_cr.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "opal/util/opal_environ.h"
@ -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_EVLOOP_NONBLOCK);
opal_event.loop(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_EVLOOP_NONBLOCK);
opal_event.loop(OPAL_EVLOOP_NONBLOCK);
}
/* Clear the ack queue if it isn't already clear (it should already be) */

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

@ -26,7 +26,7 @@
#include "ompi_config.h"
#include "opal/class/opal_list.h"
#include "ompi/class/ompi_free_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/mca/mpool/mpool.h"
BEGIN_C_DECLS

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

@ -27,7 +27,7 @@
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/mca/common/sm/common_sm.h"
#include "ompi/mca/mpool/mpool.h"

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

@ -160,7 +160,7 @@ ompi_mtl_mx_add_procs(struct mca_mtl_base_module_t *mtl,
progress MX as often as possible during the stage gate 2. This
would have happened after the stage gate anyway, so we're just
speeding things up a bit. */
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
/* switch from letting us sit in the event library for a bit each
time through opal_progress() to completely non-blocking */
opal_progress_set_event_flag(OPAL_EVLOOP_NONBLOCK);

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

@ -18,7 +18,7 @@
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/mca/base/mca_base_param.h"
#include "ompi/mca/mtl/base/base.h"
#include "ompi/mca/common/mx/common_mx.h"

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

@ -20,7 +20,7 @@
#define MCA_MTL_MX_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/proc/proc.h"
#include "ompi/mca/mtl/mtl.h"
#include "mtl_mx.h"

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

@ -170,7 +170,7 @@ OBJ_CLASS_DECLARATION(ompi_mtl_portals_event_t);
#define PTL_IS_READY_MSG(match_bits) \
(0 != (PTL_READY_MSG & match_bits))
#define PTL_IS_SYNC_MSG(event) \
(0 != event.hdr_data)
(0 != opal_event.hdr_data)
#define PTL_GET_TAG(match_bits) ((int)(match_bits & PTL_TAG_MASK))
#define PTL_GET_SOURCE(match_bits) ((int)((match_bits & PTL_SOURCE_MASK) >> 32))

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

@ -18,7 +18,7 @@
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "opal/mca/base/mca_base_param.h"
#include "ompi/mca/common/portals/common_portals.h"

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

@ -20,7 +20,7 @@
#include "ompi_config.h"
#include "orte/util/show_help.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "opal/mca/base/mca_base_param.h"
#include "ompi/proc/proc.h"

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

@ -21,7 +21,7 @@
#define MCA_MTL_PSM_ENDPOINT_H
#include "opal/class/opal_list.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "ompi/mca/mtl/mtl.h"
#include "mtl_psm.h"

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

@ -55,7 +55,7 @@ ompi_osc_pt2pt_module_free(ompi_win_t *win)
ret = (ret != OMPI_SUCCESS) ? ret : tmp;
if (0 == opal_hash_table_get_size(&mca_osc_pt2pt_component.p2p_c_modules)) {
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
void *foo;
mca_osc_pt2pt_component.p2p_c_thread_run = false;

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

@ -68,7 +68,7 @@ struct ompi_osc_pt2pt_component_t {
/** list of outstanding requests, of type ompi_osc_pt2pt_mpireq_t */
opal_list_t p2p_c_pending_requests;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
opal_thread_t p2p_c_thread;
bool p2p_c_thread_run;
#endif

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

@ -41,7 +41,7 @@
static int component_open(void);
static void component_fragment_cb(ompi_osc_pt2pt_mpireq_t *mpireq);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
static void* component_thread_fn(opal_object_t *obj);
#endif
@ -205,7 +205,7 @@ ompi_osc_pt2pt_component_init(bool enable_progress_threads,
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.p2p_c_pending_requests,
opal_list_t);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.p2p_c_thread, opal_thread_t);
mca_osc_pt2pt_component.p2p_c_thread_run = false;
#endif
@ -218,7 +218,7 @@ int
ompi_osc_pt2pt_component_finalize(void)
{
size_t num_modules;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
void* ret;
#endif
@ -227,7 +227,7 @@ ompi_osc_pt2pt_component_finalize(void)
opal_output(ompi_osc_base_output,
"WARNING: There were %d Windows created but not freed.",
(int) num_modules);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
mca_osc_pt2pt_component.p2p_c_thread_run = false;
opal_condition_broadcast(&ompi_request_cond);
opal_thread_join(&mca_osc_pt2pt_component.p2p_c_thread, &ret);
@ -367,7 +367,7 @@ ompi_osc_pt2pt_component_select(ompi_win_t *win,
module);
ret = opal_hash_table_get_size(&mca_osc_pt2pt_component.p2p_c_modules);
if (ret == 1) {
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
mca_osc_pt2pt_component.p2p_c_thread_run = true;
mca_osc_pt2pt_component.p2p_c_thread.t_run = component_thread_fn;
mca_osc_pt2pt_component.p2p_c_thread.t_arg = NULL;
@ -706,7 +706,7 @@ ompi_osc_pt2pt_component_progress(void)
opal_list_item_t *item;
int ret, done = 0;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
OPAL_THREAD_LOCK(&mca_osc_pt2pt_component.p2p_c_lock);
#else
ret = OPAL_THREAD_TRYLOCK(&mca_osc_pt2pt_component.p2p_c_lock);
@ -720,7 +720,7 @@ ompi_osc_pt2pt_component_progress(void)
(ompi_osc_pt2pt_mpireq_t*) item;
/* BWB - FIX ME */
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
if (buffer->request->req_state == OMPI_REQUEST_INACTIVE ||
buffer->request->req_complete) {
ret = ompi_request_test(&buffer->request,
@ -750,7 +750,7 @@ ompi_osc_pt2pt_component_progress(void)
return done;
}
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
static void*
component_thread_fn(opal_object_t *obj)
{

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

@ -366,7 +366,7 @@ ompi_osc_pt2pt_module_test(ompi_win_t *win,
ompi_group_t *group;
ompi_osc_pt2pt_module_t *module = P2P_MODULE(win);
#if !OPAL_ENABLE_PROGRESS_THREADS
#if !OMPI_ENABLE_PROGRESS_THREADS
opal_progress();
#endif

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

@ -55,7 +55,7 @@ ompi_osc_rdma_module_free(ompi_win_t *win)
ret = (ret != OMPI_SUCCESS) ? ret : tmp;
if (0 == opal_hash_table_get_size(&mca_osc_rdma_component.c_modules)) {
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
void *foo;
mca_osc_rdma_component.c_thread_run = false;

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

@ -72,7 +72,7 @@ struct ompi_osc_rdma_component_t {
/** list of outstanding requests, of type ompi_osc_pt2pt_longreq_t */
opal_list_t c_pending_requests;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
opal_thread_t c_thread;
bool c_thread_run;
#endif

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

@ -49,7 +49,7 @@ static void component_fragment_cb(struct mca_btl_base_module_t *btl,
mca_btl_base_tag_t tag,
mca_btl_base_descriptor_t *descriptor,
void *cbdata);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
static void* component_thread_fn(opal_object_t *obj);
#endif
static int setup_rdma(ompi_osc_rdma_module_t *module);
@ -223,7 +223,7 @@ ompi_osc_rdma_component_init(bool enable_progress_threads,
OBJ_CONSTRUCT(&mca_osc_rdma_component.c_pending_requests,
opal_list_t);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
OBJ_CONSTRUCT(&mca_osc_rdma_component.c_thread, opal_thread_t);
mca_osc_rdma_component.c_thread_run = false;
#endif
@ -246,7 +246,7 @@ ompi_osc_rdma_component_finalize(void)
opal_output(ompi_osc_base_output,
"WARNING: There were %d Windows created but not freed.",
(int) num_modules);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
mca_osc_rdma_component.c_thread_run = false;
opal_condition_broadcast(&ompi_request_cond);
{
@ -260,7 +260,7 @@ ompi_osc_rdma_component_finalize(void)
mca_bml.bml_register(MCA_BTL_TAG_OSC_RDMA, NULL, NULL);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
OBJ_DESTRUCT(&mca_osc_rdma_component.c_thread);
#endif
OBJ_DESTRUCT(&mca_osc_rdma_component.c_pending_requests);
@ -415,7 +415,7 @@ ompi_osc_rdma_component_select(ompi_win_t *win,
module);
ret = opal_hash_table_get_size(&mca_osc_rdma_component.c_modules);
if (ret == 1) {
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
mca_osc_rdma_component.c_thread_run = true;
mca_osc_rdma_component.c_thread.t_run = component_thread_fn;
mca_osc_rdma_component.c_thread.t_arg = NULL;
@ -941,7 +941,7 @@ ompi_osc_rdma_component_progress(void)
opal_list_item_t *item;
int ret, done = 0;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
OPAL_THREAD_LOCK(&mca_osc_rdma_component.c_lock);
#else
ret = OPAL_THREAD_TRYLOCK(&mca_osc_rdma_component.c_lock);
@ -955,7 +955,7 @@ ompi_osc_rdma_component_progress(void)
(ompi_osc_rdma_longreq_t*) item;
/* BWB - FIX ME */
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
if (longreq->request->req_state == OMPI_REQUEST_INACTIVE ||
longreq->request->req_complete) {
ret = ompi_request_test(&longreq->request,
@ -986,7 +986,7 @@ ompi_osc_rdma_component_progress(void)
}
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
static void*
component_thread_fn(opal_object_t *obj)
{

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

@ -461,7 +461,7 @@ ompi_osc_rdma_module_test(ompi_win_t *win,
ompi_group_t *group;
ompi_osc_rdma_module_t *module = GET_MODULE(win);
#if !OPAL_ENABLE_PROGRESS_THREADS
#if !OMPI_ENABLE_PROGRESS_THREADS
opal_progress();
#endif

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

@ -20,7 +20,7 @@
*/
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "mpi.h"
#include "ompi/runtime/params.h"
#include "ompi/mca/pml/pml.h"

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

@ -18,7 +18,7 @@
#include "ompi_config.h"
#include "pml_cm.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/mca/base/mca_base_param.h"
#include "ompi/mca/mtl/mtl.h"
#include "ompi/mca/mtl/base/base.h"

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

@ -20,7 +20,7 @@
#include "ompi_config.h"
#include "opal/runtime/opal.h"
#include "opal/util/output.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "mpi.h"

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

@ -23,7 +23,7 @@
*/
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "mpi.h"
#include "ompi/runtime/params.h"
#include "ompi/mca/pml/pml.h"

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

@ -19,7 +19,7 @@ AC_DEFUN([MCA_ompi_pml_dr_CONFIG],[
# support for 64 bits atomics.
AS_IF([test $OPAL_ASM_SUPPORT_64BIT -eq 1],
[$1],
[AS_IF([test $OPAL_ENABLE_PROGRESS_THREADS -eq 1 -o $OMPI_ENABLE_THREAD_MULTIPLE -eq 1],
[AS_IF([test $OMPI_ENABLE_PROGRESS_THREADS -eq 1 -o $OMPI_ENABLE_THREAD_MULTIPLE -eq 1],
[$2],
[$1])
])

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

@ -18,7 +18,7 @@
*/
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "mpi.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/btl/base/base.h"

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

@ -35,7 +35,7 @@
#include "pml_dr_hdr.h"
#include "pml_dr_vfrag.h"
#include "pml_dr_endpoint.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
BEGIN_C_DECLS

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

@ -42,14 +42,17 @@ 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;
opal_evtimer_set(&vfrag->vf_wdog_ev, mca_pml_dr_vfrag_wdog_timeout, (void*) vfrag);
opal_evtimer_set(&vfrag->vf_ack_ev, mca_pml_dr_vfrag_ack_timeout, (void*) vfrag);
OBJ_CONSTRUCT(&vfrag->vf_wdog_ev, opal_event_t);
opal_event.evtimer_set(&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(&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);
}

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

@ -22,7 +22,7 @@
#define OMPI_PML_DR_VFRAG_H_
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/types.h"
#include "pml_dr.h"
@ -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) \

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

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

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

@ -20,7 +20,7 @@
*/
#include "ompi_config.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "mpi.h"
#include "ompi/runtime/params.h"
#include "ompi/mca/pml/pml.h"

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

@ -55,7 +55,7 @@ mca_pml_base_component_2_0_0_t mca_pml_v_component =
mca_pml_v_component_finalize /* component finalize */
};
static bool pml_v_enable_progress_treads = OPAL_ENABLE_PROGRESS_THREADS;
static bool pml_v_enable_progress_treads = OMPI_ENABLE_PROGRESS_THREADS;
static bool pml_v_enable_mpi_threads = OMPI_ENABLE_THREAD_MULTIPLE;
/*******************************************************************************

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

@ -97,7 +97,7 @@ int MPI_Cart_create(MPI_Comm old_comm, int ndims, int *dims,
return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME);
}
if (OMPI_SUCCESS !=
(err = mca_topo_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(err = mca_topo_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME);
}

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

@ -70,7 +70,7 @@ int MPI_File_delete(char *filename, MPI_Info info)
return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME);
}
if (OMPI_SUCCESS !=
(rc = mca_io_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(rc = mca_io_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME);
}

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

@ -82,7 +82,7 @@ int MPI_File_open(MPI_Comm comm, char *filename, int amode,
return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME);
}
if (OMPI_SUCCESS !=
(rc = mca_io_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(rc = mca_io_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME);
}

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

@ -91,7 +91,7 @@ int MPI_Graph_create(MPI_Comm old_comm, int nnodes, int *index,
return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME);
}
if (OMPI_SUCCESS !=
(err = mca_topo_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(err = mca_topo_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
return OMPI_ERRHANDLER_INVOKE(old_comm, err, FUNC_NAME);
}

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

@ -64,7 +64,7 @@ int MPI_Register_datarep(char *datarep,
return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME);
}
if (OMPI_SUCCESS !=
(rc = mca_io_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(rc = mca_io_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME);
}

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

@ -44,7 +44,7 @@ static const char FUNC_NAME[] = "MPI_Request_get_status";
int MPI_Request_get_status(MPI_Request request, int *flag,
MPI_Status *status)
{
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
int do_it_once = 0;
#endif
@ -64,7 +64,7 @@ int MPI_Request_get_status(MPI_Request request, int *flag,
}
}
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
recheck_request_status:
#endif
opal_atomic_mb();
@ -88,7 +88,7 @@ int MPI_Request_get_status(MPI_Request request, int *flag,
}
return MPI_SUCCESS;
}
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
if( 0 == do_it_once ) {
/* If we run the opal_progress then check the status of the
request before leaving. We will call the opal_progress only

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

@ -31,7 +31,7 @@ int ompi_request_default_test( ompi_request_t ** rptr,
ompi_status_public_t * status )
{
ompi_request_t *request = *rptr;
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
int do_it_once = 0;
recheck_request_status:
@ -79,7 +79,7 @@ int ompi_request_default_test( ompi_request_t ** rptr,
later! */
return ompi_request_free(rptr);
}
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
if( 0 == do_it_once ) {
/**
* If we run the opal_progress then check the status of the request before
@ -160,7 +160,7 @@ int ompi_request_default_test_any(
*index = MPI_UNDEFINED;
if(num_requests_null_inactive != count) {
*completed = false;
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
opal_progress();
#endif
} else {
@ -197,7 +197,7 @@ int ompi_request_default_test_all(
if (num_completed != count) {
*completed = false;
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
opal_progress();
#endif
return OMPI_SUCCESS;
@ -311,7 +311,7 @@ int ompi_request_default_test_some(
*outcount = num_requests_done;
if (num_requests_done == 0) {
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
opal_progress();
#endif
return OMPI_SUCCESS;

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

@ -82,7 +82,7 @@ int ompi_request_default_wait_any(
int *index,
ompi_status_public_t * status)
{
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
int c;
#endif
size_t i=0, num_requests_null_inactive=0;
@ -91,9 +91,9 @@ int ompi_request_default_wait_any(
ompi_request_t **rptr=NULL;
ompi_request_t *request=NULL;
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
/* poll for completion */
OPAL_THREAD_ADD32(&opal_progress_thread_count,1);
OPAL_THREAD_ADD32(&ompi_progress_thread_count,1);
for (c = 0; completed < 0 && c < opal_progress_spin_count; c++) {
rptr = requests;
num_requests_null_inactive = 0;
@ -109,17 +109,17 @@ int ompi_request_default_wait_any(
}
if (true == request->req_complete) {
completed = i;
OPAL_THREAD_ADD32(&opal_progress_thread_count,-1);
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
goto finished;
}
}
if( num_requests_null_inactive == count ) {
OPAL_THREAD_ADD32(&opal_progress_thread_count,-1);
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
goto finished;
}
opal_progress();
}
OPAL_THREAD_ADD32(&opal_progress_thread_count,-1);
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
#endif
/* give up and sleep until completion */
@ -158,9 +158,9 @@ int ompi_request_default_wait_any(
ompi_request_waiting--;
OPAL_THREAD_UNLOCK(&ompi_request_lock);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
finished:
#endif /* OPAL_ENABLE_PROGRESS_THREADS */
#endif /* OMPI_ENABLE_PROGRESS_THREADS */
if(num_requests_null_inactive == count) {
*index = MPI_UNDEFINED;
@ -361,7 +361,7 @@ int ompi_request_default_wait_some(
int * indices,
ompi_status_public_t * statuses)
{
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
int c;
#endif
size_t i, num_requests_null_inactive=0, num_requests_done=0;
@ -374,9 +374,9 @@ int ompi_request_default_wait_some(
indices[i] = 0;
}
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
/* poll for completion */
OPAL_THREAD_ADD32(&opal_progress_thread_count,1);
OPAL_THREAD_ADD32(&ompi_progress_thread_count,1);
for (c = 0; c < opal_progress_spin_count; c++) {
rptr = requests;
num_requests_null_inactive = 0;
@ -398,12 +398,12 @@ int ompi_request_default_wait_some(
}
if (num_requests_null_inactive == count ||
num_requests_done > 0) {
OPAL_THREAD_ADD32(&opal_progress_thread_count,-1);
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
goto finished;
}
opal_progress();
}
OPAL_THREAD_ADD32(&opal_progress_thread_count,-1);
OPAL_THREAD_ADD32(&ompi_progress_thread_count,-1);
#endif
/*
@ -439,9 +439,9 @@ int ompi_request_default_wait_some(
ompi_request_waiting--;
OPAL_THREAD_UNLOCK(&ompi_request_lock);
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
finished:
#endif /* OPAL_ENABLE_PROGRESS_THREADS */
#endif /* OMPI_ENABLE_PROGRESS_THREADS */
#if OPAL_ENABLE_FT_CR == 1
if( opal_cr_is_enabled) {

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

@ -366,7 +366,7 @@ static inline int ompi_request_free(ompi_request_t** request)
static inline void ompi_request_wait_completion(ompi_request_t *req)
{
if(false == req->req_complete) {
#if OPAL_ENABLE_PROGRESS_THREADS
#if OMPI_ENABLE_PROGRESS_THREADS
if(opal_progress_spin(&req->req_complete)) {
return;
}

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

@ -39,7 +39,7 @@
#include <sys/stat.h> /* for mkfifo */
#endif /* HAVE_SYS_STAT_H */
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "opal/mca/crs/crs.h"
#include "opal/mca/crs/base/base.h"

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

@ -38,7 +38,7 @@
#include <netdb.h>
#endif
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/util/output.h"
#include "opal/runtime/opal_progress.h"
#include "opal/mca/maffinity/base/base.h"
@ -143,7 +143,7 @@ int ompi_mpi_finalize(void)
ompi_mpi_finalized = true;
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
opal_progress_set_event_flag(OPAL_EVLOOP_ONELOOP);
#endif

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

@ -46,7 +46,7 @@
#include "opal/util/stacktrace.h"
#include "opal/util/show_help.h"
#include "opal/runtime/opal.h"
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "orte/util/proc_info.h"
#include "orte/runtime/runtime.h"
@ -531,7 +531,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
goto error;
}
if (OMPI_SUCCESS !=
(ret = ompi_op_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(ret = ompi_op_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
error = "ompi_op_base_find_available() failed";
goto error;
@ -585,14 +585,14 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
/* Select which MPI components to use */
if (OMPI_SUCCESS !=
(ret = mca_mpool_base_init(OPAL_ENABLE_PROGRESS_THREADS,
(ret = mca_mpool_base_init(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
error = "mca_mpool_base_init() failed";
goto error;
}
if (OMPI_SUCCESS !=
(ret = mca_pml_base_select(OPAL_ENABLE_PROGRESS_THREADS,
(ret = mca_pml_base_select(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
error = "mca_pml_base_select() failed";
goto error;
@ -606,14 +606,14 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
}
if (OMPI_SUCCESS !=
(ret = mca_coll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(ret = mca_coll_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
error = "mca_coll_base_find_available() failed";
goto error;
}
if (OMPI_SUCCESS !=
(ret = ompi_osc_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
(ret = ompi_osc_base_find_available(OMPI_ENABLE_PROGRESS_THREADS,
OMPI_ENABLE_THREAD_MULTIPLE))) {
error = "ompi_osc_base_find_available() failed";
goto error;
@ -727,7 +727,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
/* If thread support was enabled, then setup OPAL to allow for
them. */
if ((OPAL_ENABLE_PROGRESS_THREADS == 1) ||
if ((OMPI_ENABLE_PROGRESS_THREADS == 1) ||
(*provided != MPI_THREAD_SINGLE)) {
opal_set_using_threads(true);
}
@ -803,7 +803,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
gettimeofday(&ompistart, NULL);
}
#if OPAL_ENABLE_PROGRESS_THREADS == 0
#if OMPI_ENABLE_PROGRESS_THREADS == 0
/* Start setting up the event engine for MPI operations. Don't
block in the event library, so that communications don't take
forever between procs in the dynamic code. This will increase

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

@ -42,7 +42,7 @@
#include <signal.h>
#include "opal/event/event.h"
#include "opal/mca/event/event.h"
#include "opal/mca/base/base.h"
#include "opal/util/cmd_line.h"
#include "opal/util/output.h"
@ -241,12 +241,14 @@ int main(int argc, char *argv[])
/* Set signal handlers to catch kill signals so we can properly clean up
* after ourselves.
*/
opal_event_set(&term_handler, SIGTERM, OPAL_EV_SIGNAL,
OBJ_CONSTRUCT(&term_handler, opal_event_t);
opal_event.set(&term_handler, SIGTERM, OPAL_EV_SIGNAL,
shutdown_callback, NULL);
opal_event_add(&term_handler, NULL);
opal_event_set(&int_handler, SIGINT, OPAL_EV_SIGNAL,
opal_event.add(&term_handler, NULL);
OBJ_CONSTRUCT(&int_handler, opal_event_t);
opal_event.set(&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
@ -282,7 +284,7 @@ int main(int argc, char *argv[])
}
/* wait to hear we are done */
opal_event_dispatch();
opal_event.dispatch();
/* should never get here, but if we do... */

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -27,7 +27,7 @@
#include "opal/util/argv.h"
#include "opal/event/event.h"
#include "opal/mca/event/base/base.h"
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "opal/mca/backtrace/backtrace.h"
@ -210,8 +210,8 @@ void ompi_info_open_components(void)
}
/* some components require the event library be active, so activate it */
if (OPAL_SUCCESS != opal_event_init()) {
str = "opal_event_init failed";
if (OPAL_SUCCESS != opal_event_base_open()) {
str = "opal_event_base_open";
goto error;
}
@ -282,6 +282,14 @@ void ompi_info_open_components(void)
map->components = &opal_memory_base_components_opened;
opal_pointer_array_add(&component_map, map);
if (OPAL_SUCCESS != opal_event_base_open()) {
goto error;
}
map = OBJ_NEW(ompi_info_component_map_t);
map->type = strdup("event");
map->components = &opal_event_components;
opal_pointer_array_add(&component_map, map);
if (OPAL_SUCCESS != opal_memchecker_base_open()) {
goto error;
}
@ -720,6 +728,7 @@ void ompi_info_close_components()
(void) mca_coll_base_close();
(void) mca_allocator_base_close();
(void) ompi_osc_base_close();
(void) orte_grpcomm_base_close();
(void) orte_db_base_close();
(void) orte_notifier_base_close();
@ -755,6 +764,7 @@ void ompi_info_close_components()
#if OPAL_ENABLE_FT_CR == 1
(void) opal_crs_base_close();
#endif
(void) opal_event_base_close();
/* Do not call OPAL's installdirs close; it will be handled in
* opal_finalize_util().

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copryight (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
* Copryight (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -204,6 +204,7 @@ int main(int argc, char *argv[])
opal_pointer_array_add(&mca_types, "compress");
#endif
opal_pointer_array_add(&mca_types, "if");
opal_pointer_array_add(&mca_types, "event");
opal_pointer_array_add(&mca_types, "dpm");
opal_pointer_array_add(&mca_types, "pubsub");

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

@ -576,7 +576,7 @@ void ompi_info_do_config(bool want_all)
asprintf(&threads, "%s (mpi: %s, progress: %s)", OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
(OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"),
OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no",
OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no");
OMPI_ENABLE_PROGRESS_THREADS ? "yes" : "no");
} else {
threads = strdup("no");
}

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

@ -25,7 +25,6 @@ SUBDIRS = \
asm \
datatype \
etc \
event \
util \
mca/base \
$(MCA_opal_FRAMEWORKS_SUBDIRS) \
@ -39,7 +38,6 @@ DIST_SUBDIRS = \
asm \
datatype \
etc \
event \
util \
mca/base \
$(MCA_opal_FRAMEWORKS_SUBDIRS) \
@ -53,7 +51,6 @@ libopen_pal_la_LIBADD = \
$(LIBLTDL) \
asm/libasm.la \
datatype/libdatatype.la \
event/libevent.la \
mca/base/libmca_base.la \
util/libopalutil.la \
$(MCA_opal_FRAMEWORK_LIBS)

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

@ -17,9 +17,6 @@ AC_DEFUN([OPAL_CONFIG_FILES],[
opal/include/Makefile
opal/asm/Makefile
opal/datatype/Makefile
opal/event/Makefile
opal/event/compat/Makefile
opal/event/compat/sys/Makefile
opal/util/Makefile
opal/util/keyval/Makefile
opal/mca/base/Makefile

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

@ -1,403 +0,0 @@
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OPAL_SETUP_LIBEVENT],[
dnl OMPI: don't use AC_LIBOBJ
sources=
dnl Check for optional stuff
AC_ARG_WITH(event-rtsig,
AC_HELP_STRING([--with-event-rtsig],
[compile with support for real time signals (experimental)]),
[usertsig=yes], [usertsig=no])
dnl Checks for libraries.
dnl AC_CHECK_LIB(socket, socket)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h stdarg.h inttypes.h stdint.h poll.h signal.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/ioctl.h sys/devpoll.h)
if test "x$ac_cv_header_sys_queue_h" = "xyes"; then
AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h)
AC_EGREP_CPP(yes,
[
#include <sys/queue.h>
#ifdef TAILQ_FOREACH
yes
#endif
], [AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TAILQFOREACH, 1,
[Define if TAILQ_FOREACH is defined in <sys/queue.h>])],
AC_MSG_RESULT(no)
)
fi
if test "x$ac_cv_header_sys_time_h" = "xyes"; then
AC_MSG_CHECKING(for timeradd in sys/time.h)
AC_EGREP_CPP(yes,
[
#include <sys/time.h>
#ifdef timeradd
yes
#endif
], [ AC_DEFINE(HAVE_TIMERADD, 1,
[Define if timeradd is defined in <sys/time.h>])
AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
)
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
dnl Checks for library functions.
AC_CHECK_FUNCS(gettimeofday vasprintf fcntl strtoll)
AC_MSG_CHECKING(for F_SETFD in fcntl.h)
AC_EGREP_CPP(yes,
[
#define _GNU_SOURCE
#include <fcntl.h>
#ifdef F_SETFD
yes
#endif
], [ AC_DEFINE(HAVE_SETFD, 1,
[Define if F_SETFD is defined in <fcntl.h>])
AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no))
needsignal=no
haveselect=no
AC_CHECK_FUNCS(select, [haveselect=yes], )
if test "x$haveselect" = "xyes" ; then
# OMPI: Don't use AC_LIBOBJ
sources="select.c $sources"
needsignal=yes
fi
havepoll=no
havertsig=no
AC_CHECK_FUNCS(poll, [havepoll=yes], )
case "$host" in
*apple-darwin*)
haveworkingpoll=0
;;
*)
if test "$havepoll" = "yes" ; then
haveworkingpoll=1
else
haveworkingpoll=0
fi
;;
esac
AC_DEFINE_UNQUOTED([HAVE_WORKING_POLL], [$haveworkingpoll],
[Whether poll works for file descriptors and devices])
if test "x$havepoll" = "xyes" -a "$haveworkingpoll" = "1" ; then
# OMPI: Don't use AC_LIBOBJ
sources="poll.c $sources"
needsignal=yes
if test "x$usertsig" = "xyes" ; then
AC_CHECK_FUNCS(sigtimedwait, [havertsig=yes], )
fi
fi
if test "x$havertsig" = "xyes" ; then
AC_MSG_CHECKING(for F_SETSIG in fcntl.h)
AC_EGREP_CPP(yes,
[
#define _GNU_SOURCE
#include <fcntl.h>
#ifdef F_SETSIG
yes
#endif
], [ AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no); havertsig=no])
fi
if test "x$havertsig" = "xyes" ; then
AC_DEFINE(HAVE_RTSIG, 1, [Define if your system supports POSIX realtime signals])
# OMPI: Don't use AC_LIBOBJ
sources="rtsig.c $sources"
AC_MSG_CHECKING(for working rtsig on pipes)
AC_TRY_RUN(
[
#define _GNU_SOURCE
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
int sigio()
{
exit(0);
}
int main()
{
int fd[2];
pipe(fd);
signal(SIGIO, sigio);
fcntl(fd[0], F_SETOWN, getpid());
fcntl(fd[0], F_SETSIG, SIGIO);
fcntl(fd[0], F_SETFL, fcntl(fd[0], F_GETFL) | O_ASYNC);
write(fd[1], "", 1);
return 1;
}
], [ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WORKING_RTSIG, 1, [Define if realtime signals work on pipes])],
[ AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)])
fi
haveepoll=no
AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
if test "x$haveepoll" = "xyes" -a "$cross_compiling" != "yes" ; then
# OMPI: Unfortunately, this test is not sufficient on some
# Linux distros (e.g., RH 9), where the function is defined
# and you can link against it, but it's hardwired to return
# ENOSYS -- and /usr/include/gnu/stubs.h fails to define
# __stub_epoll_ctl (the usual mechanism in glibc to indicate
# that a function is a stub and isn't really implemented).
# Hence, the test succeeds because it thinks it can use
# epoll_ctl (and friends). So we have to do a better test
# after we determine that epoll_ctl is linkable. Grumble.
# If we are cross compiling, just trust AC_CHECK_FUNCS
# OMPI: Unfortunately, this test is not sufficient for another
# reason. The event_poll struct is defined in the sys/epoll.h
# file. The structure is the interface between the application
# and the kernel and is therefore compiled into both. The
# event_poll struct is defined with a compiler directive
# __attribute__ ((__packed__). It turns out that there is
# at least one compiler (Sun Studio) that does not currently
# recognize this directive. This means that the event_poll
# struct may be packed in the kernel, but not in the OMPI
# library. Badness ensues. Therefore, check to see that
# this struct gets correctly passed between OMPI and the
# kernel.
# In this test we use epoll in Level Triggered mode. We create a pipe
# and the write only file descriptor of the pipe is added to
# the epoll set. The test is successful if epoll_wait() returns 1
# indicating that the fd is ready to be written to.
haveepoll=no
AC_MSG_CHECKING([for working epoll library interface])
AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_INCLUDES_DEFAULT[
#include <sys/epoll.h>]],
[[
struct epoll_event epevin;
struct epoll_event epevout;
int res;
int epfd;
int fildes[2];
if ((epfd = epoll_create(1)) == -1)
exit(1);
if (pipe(&fildes[0]) < 0)
exit(1);
memset(&epevin, 0, sizeof(epevin));
memset(&epevout, 0, sizeof(epevout));
memset(&epevin.data.ptr, 5, sizeof(epevin.data.ptr));
epevin.events = EPOLLIN | EPOLLOUT;
if (epoll_ctl(epfd, EPOLL_CTL_ADD, fildes[1], &epevin) == -1)
exit(1);
res = epoll_wait(epfd, &epevout, 1, 0);
if (res != 1) {
exit(1);
} else {
if (epevout.data.ptr != epevin.data.ptr) {
exit(1);
}
}
/* SUCCESS */
]])],
[haveepoll=yes
AC_DEFINE(HAVE_EPOLL, 1,
[Define if your system supports the epoll interface])
# OMPI: Don't use AC_LIBOBJ
sources="epoll.c $sources"
needsignal=yes], [], [haveepoll=no])
AC_MSG_RESULT([$haveepoll])
fi
haveepollsyscall=no
if test "x$ac_cv_header_sys_epoll_h" = "xyes" -a "x$haveepoll" = "xno" -a "$cross_compiling" != "yes"; then
# OMPI: See comment above. This test uses the epoll system call
# interface instead of the library interface.
AC_MSG_CHECKING(for working epoll system call)
AC_RUN_IFELSE([AC_LANG_PROGRAM([
AC_INCLUDES_DEFAULT[
#include <sys/syscall.h>
#include <sys/epoll.h>]],
[[
struct epoll_event epevin;
struct epoll_event epevout;
int res;
int epfd;
int fildes[2];
if ((epfd = syscall(__NR_epoll_create, 1)) == -1)
exit(1);
if (pipe(&fildes[0]) < 0)
exit(1);
memset(&epevin, 0, sizeof(epevin));
memset(&epevout, 0, sizeof(epevout));
memset(&epevin.data.ptr, 5, sizeof(epevin.data.ptr));
epevin.events = EPOLLIN | EPOLLOUT;
if (syscall(__NR_epoll_ctl, epfd,
EPOLL_CTL_ADD, fildes[1], &epevin) == -1)
exit(1);
res = syscall(__NR_epoll_wait, epfd, &epevout, 1, 0);
if (res != 1) {
exit(1);
} else {
if (epevout.data.ptr != epevin.data.ptr) {
exit(1);
}
}
/* SUCCESS */
]])],
[haveepollsyscall=yes
AC_DEFINE(HAVE_EPOLL, 1,
[Define if your system supports the epoll interface])
# OMPI: don't use AC_LIBOBJ
sources="epoll_sub.c epoll.c $sources"
needsignal=yes], [], [haveepollsyscall=no])
AC_MSG_RESULT([$haveepollsyscall])
fi
havedevpoll=no
if test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then
AC_DEFINE(HAVE_DEVPOLL, 1,
[Define if /dev/poll is available])
# OMPI: Don't use AC_LIBOBJ(devpoll)
sources="devpoll.c $sources"
needsignal=yes
fi
havekqueue=no
if test "x$ac_cv_header_sys_event_h" = "xyes"; then
# All versions of MAC OS X before at least 10.5.2 are
# completely broken when kqueue is used with pty. So, until
# they get fixed, completely disable kqueue on MAC OS X.
case "$host" in
*apple-darwin*)
AC_MSG_CHECKING(for working kqueue)
havekqueue="no"
AC_MSG_RESULT([no (MAC OS X)])
;;
*)
AC_CHECK_FUNCS(kqueue, [havekqueue=yes], )
;;
esac
if test "x$havekqueue" = "xyes" ; then
AC_MSG_CHECKING(for working kqueue)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/time.h>
#include <sys/event.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
int
main()
{
int kq;
int n;
int fd[2];
struct kevent ev;
struct timespec ts;
char buf[8000];
if (pipe(fd) == -1)
exit(1);
if (fcntl(fd[1], F_SETFL, O_NONBLOCK) == -1)
exit(1);
while ((n = write(fd[1], buf, sizeof(buf))) == sizeof(buf))
;
if ((kq = kqueue()) == -1)
exit(1);
ev.ident = fd[1];
ev.filter = EVFILT_WRITE;
ev.flags = EV_ADD | EV_ENABLE;
n = kevent(kq, &ev, 1, NULL, 0, NULL);
if (n == -1)
exit(1);
read(fd[0], buf, sizeof(buf));
ts.tv_sec = 0;
ts.tv_nsec = 0;
n = kevent(kq, NULL, 0, &ev, 1, &ts);
if (n == -1 || n == 0)
exit(1);
exit(0);
}], [AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WORKING_KQUEUE, 1,
[Define if kqueue works correctly with pipes])
sources="kqueue.c $sources"], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)])
# OMPI: don't use AC_LIBOBJ
fi
fi
haveeventports=no
AC_CHECK_FUNCS(port_create, [haveeventports=yes], )
# JMS Per #1273, Solaris event ports are temporarily disabled.
haveeventports=no
if test "x$haveeventports" = "xyes" ; then
AC_DEFINE(HAVE_EVENT_PORTS, 1,
[Define if your system supports event ports])
sources="evport.c $sources"
needsignal=yes
fi
if test "x$needsignal" = "xyes" ; then
# OMPI: don't use AC_LIBOBJ
sources="signal.c $sources"
fi
# OMPI: AC_REPLACE_FUNCS doesn't have much meaning here because it
# uses AC_LIBOBJ; use our own test
#AC_REPLACE_FUNCS(err)
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(u_int64_t, unsigned long long)
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int8_t, unsigned char)
# OMPI: Save the libobj sources
OPAL_LIBEVENT_SOURCES="$sources"
AC_SUBST(OPAL_LIBEVENT_SOURCES)
# OMPI: All done
unset sources])dnl

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

@ -1,41 +0,0 @@
# Copyright (c) 2007-2008 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
INCLUDE (event/WIN32-Code/CMakeLists.txt) # or use INCLUDE (${OpenMPI_SOURCE_DIR}/opal/event/WIN32-Code/CMakeLists.txt)
FOREACH (FILE ${EVENT_WIN32_FILES})
SET (EVENT_FILES ${EVENT_FILES} WIN32-Code/${FILE})
ENDFOREACH (FILE)
INCLUDE (event/compat/sys/CMakeLists.txt)
FOREACH (FILE ${COMPAT_SYS_FILES})
SET (EVENT_FILES ${EVENT_FILES} compat/sys/${FILE})
ENDFOREACH (FILE)
IF(WIN32)
INCLUDE_DIRECTORIES ("${PROJECT_SOURCE_DIR}/event/compat"
"${PROJECT_SOURCE_DIR}/event/WIN32-Code")
SET(EVENT_FILES
${EVENT_FILES}
event-internal.h
event.h
event.c
evsignal.h
evutil.h
evutil.c
log.h
log.c
select.c
signal.c
)
ELSE(WIN32)
SET(EVENT_FILES
${EVENT_FILES}
)
ENDIF(WIN32)

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

@ -1,78 +0,0 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2009 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# History:
# Libevent 1.4.1 was 2:0:0
# Libevent 1.4.2 should be 3:0:0
# Libevent 1.4.5 is 3:0:1 (we forgot to increment in the past)
VERSION_INFO = 3:3:1
# OMPI Get the dirs where ompi_config.h and ompi_config_bottom.h live.
# Also specify where we can find this package's config.h because some
# of the header files in this directory get included elsewhere in OMPI.
# #@%@#$...
AM_CPPFLAGS = \
-I$(top_srcdir)/opal/event/compat
# OMPI: No need to build the sample or test
#SUBDIRS = . sample test
SUBDIRS = compat
EXTRA_DIST = event.h event-internal.h evsignal.h event.3 \
Doxyfile \
kqueue.c epoll_sub.c epoll.c select.c poll.c signal.c \
devpoll.c evport.c log.h\
WIN32-Code/config.h \
WIN32-Code/win32.c \
WIN32-Code/tree.h CMakeLists.txt \
WIN32-Code/CMakeLists.txt
# OMPI: This causes problems
junk = \
sample/Makefile.am sample/Makefile.in sample/event-test.c \
sample/signal-test.c sample/time-test.c \
test/Makefile.am test/Makefile.in test/bench.c test/regress.c \
test/test-eof.c test/test-weof.c test/test-time.c \
test/test-init.c test/test.sh \
compat/sys/queue.h compat/sys/_libevent_time.h \
WIN32-Code/config.h \
WIN32-Code/event-config.h \
WIN32-Code/win32.c \
WIN32-Prj/event_test/event_test.dsp \
WIN32-Prj/event_test/test.txt WIN32-Prj/libevent.dsp \
WIN32-Prj/libevent.dsw WIN32-Prj/signal_test/signal_test.dsp \
WIN32-Prj/time_test/time_test.dsp WIN32-Prj/regress/regress.vcproj \
WIN32-Prj/libevent.sln WIN32-Prj/libevent.vcproj
# OMPI: Changed to noinst and libevent.la
noinst_LTLIBRARIES = libevent.la
# OMPI: Automake sillyness so that we can have variable sources
objects = $(OPAL_LIBEVENT_SOURCES:.c=.lo)
# OMPI: Changed to libevent_la_*
headers = event.h event_rename.h evutil.h min_heap.h
libevent_la_SOURCES = event.c log.c evutil.c $(headers)
libevent_la_LIBADD = $(objects)
libevent_la_DEPENDENCIES = $(objects)
if WANT_INSTALL_HEADERS
opaldir = $(includedir)/openmpi/$(subdir)
opal_HEADERS = $(headers)
endif

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

@ -1,57 +0,0 @@
To build libevent, type
$ ./configure && make
(If you got libevent from the subversion repository, you will
first need to run the included "autogen.sh" script in order to
generate the configure script.)
Install as root via
# make install
You can run the regression tests by
$ make verify
Before, reporting any problems, please run the regression tests.
To enable the low-level tracing build the library as:
CFLAGS=-DUSE_DEBUG ./configure [...]
Acknowledgements:
-----------------
The following people have helped with suggestions, ideas, code or
fixing bugs:
Alejo
Weston Andros Adamson
William Ahern
Stas Bekman
Andrew Danforth
Mike Davis
Shie Erlich
Alexander von Gernler
Artur Grabowski
Aaron Hopkins
Claudio Jeker
Scott Lamb
Adam Langley
Philip Lewis
David Libenzi
Nick Mathewson
Andrey Matveev
Richard Nyberg
Jon Oberheide
Phil Oleson
Dave Pacheco
Tassilo von Parseval
Pierre Phaneuf
Jon Poland
Bert JW Regeer
Dug Song
Taral
If I have forgotten your name, please contact me.

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

@ -1,19 +0,0 @@
# Copyright (c) 2007-2010 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
IF(WIN32)
SET (EVENT_WIN32_FILES
${EVENT_WIN32_FILES}
config.h
tree.h
win32.c
)
ELSE(WIN32)
ENDIF(WIN32)

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

@ -1,243 +0,0 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Define if clock_gettime is available in libc */
/* #undef DNS_USE_CPU_CLOCK_FOR_ID */
/* Define if no secure id variant is available */
#define DNS_USE_FTIME_FOR_ID 1
/* Define if no secure id variant is available */
/* #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 */
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Define if /dev/poll is available */
/* #undef HAVE_DEVPOLL */
/* Define to 1 if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define if your system supports the epoll system calls */
/* #undef HAVE_EPOLL */
/* Define to 1 if you have the `epoll_ctl' function. */
/* #undef HAVE_EPOLL_CTL */
/* Define if your system supports event ports */
/* #undef HAVE_EVENT_PORTS */
/* Define to 1 if you have the `fcntl' function. */
/* #undef HAVE_FCNTL */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `getaddrinfo' function. */
/* #undef HAVE_GETADDRINFO */
/* Define to 1 if you have the `getnameinfo' function. */
/* #undef HAVE_GETNAMEINFO */
/* Define to 1 if you have the `gettimeofday' function. */
/* #define HAVE_GETTIMEOFDAY 1 */
/* Define to 1 if you have the `inet_ntop' function. */
/* #undef HAVE_INET_NTOP */
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H 1 */
/* Define to 1 if you have the `kqueue' function. */
/* #undef HAVE_KQUEUE */
/* Define to 1 if you have the `nsl' library (-lnsl). */
/* #undef HAVE_LIBNSL */
/* Define to 1 if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
/* Define to 1 if you have the `rt' library (-lrt). */
/* #undef HAVE_LIBRT */
/* Define to 1 if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <netinet/in6.h> header file. */
/* #undef HAVE_NETINET_IN6_H */
/* Define to 1 if you have the `poll' function. */
/* #undef HAVE_POLL */
/* Define to 1 if you have the <poll.h> header file. */
/* #undef HAVE_POLL_H */
/* Define to 1 if you have the `port_create' function. */
/* #undef HAVE_PORT_CREATE */
/* Define to 1 if you have the <port.h> header file. */
/* #undef HAVE_PORT_H */
/* Define to 1 if you have the `select' function. */
/* #undef HAVE_SELECT */
/* Define if F_SETFD is defined in <fcntl.h> */
/* #undef HAVE_SETFD */
/* Define to 1 if you have the `sigaction' function. */
/* #undef HAVE_SIGACTION */
/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
/* #define HAVE_STDINT_H 1 */
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */
/* Define to 1 if you have the `strsep' function. */
/* #undef HAVE_STRSEP */
/* Define to 1 if you have the `strtok_r' function. */
/* #undef HAVE_STRTOK_R */
/* Define to 1 if the system has the type `struct in6_addr'. */
#define HAVE_STRUCT_IN6_ADDR 1
/* Define to 1 if you have the <sys/devpoll.h> header file. */
/* #undef HAVE_SYS_DEVPOLL_H */
/* Define to 1 if you have the <sys/epoll.h> header file. */
/* #undef HAVE_SYS_EPOLL_H */
/* Define to 1 if you have the <sys/event.h> header file. */
/* #undef HAVE_SYS_EVENT_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
/* #undef HAVE_SYS_IOCTL_H */
/* Define to 1 if you have the <sys/queue.h> header file. */
/* #undef HAVE_SYS_QUEUE_H */
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
/* #undef HAVE_SYS_SOCKET_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
/* #define HAVE_SYS_STAT_H 1 */
/* Define to 1 if you have the <sys/time.h> header file. */
/* #define HAVE_SYS_TIME_H 1 */
/* Define to 1 if you have the <sys/types.h> header file. */
/* #define HAVE_SYS_TYPES_H 1 */
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
/* #undef HAVE_TAILQFOREACH */
/* Define if timeradd is defined in <sys/time.h> */
/* #undef HAVE_TIMERADD */
/* Define if timerclear is defined in <sys/time.h> */
/* #define HAVE_TIMERCLEAR 1 */
/* Define if timercmp is defined in <sys/time.h> */
#define HAVE_TIMERCMP 1
/* Define if timerisset is defined in <sys/time.h> */
#define HAVE_TIMERISSET 1
/* Define to 1 if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H 1 */
/* Define to 1 if you have the `vasprintf' function. */
/* #undef HAVE_VASPRINTF */
/* Define if kqueue works correctly with pipes */
/* #undef HAVE_WORKING_KQUEUE */
/* Name of package */
#define PACKAGE "libevent"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
#define VERSION "1.3.99-trunk"
/* Define to appropriate substitue if compiler doesnt have __func__ */
#if defined(_MSC_VER) && _MSC_VER < 1300
#define __func__ "??"
#else
#define __func__ __FUNCTION__
#endif
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#define inline __inline
#endif
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to unsigned int if you dont have it */
/* #unfine socklen_t unsigned int */
/* Define to `unsigned short' if <sys/types.h> does not define. */
/* #define uint16_t unsigned short */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #define uint32_t unsigned int */
/* Define to `unsigned long long' if <sys/types.h> does not define. */
/* #define uint64_t __uint64_t */
/* Define to `unsigned char' if <sys/types.h> does not define. */
/* #define uint8_t unsigned char */

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

@ -1,486 +0,0 @@
/*
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2003 Michael A. Davis <mike@datanerds.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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 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) HOWEVER 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, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "opal_config.h"
#ifdef _MSC_VER
#include "./config.h"
#else
/* Avoid the windows/msvc thing. */
#include "../config.h"
#endif
#include <winsock2.h>
#include <windows.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#define RB_AUGMENT(x) (void)(x)
#include "./tree.h"
#include "opal/event/log.h"
#include "opal/event/event.h"
#include "opal/event/event-internal.h"
#define XFREE(ptr) do { if (ptr) free(ptr); } while(0)
extern struct event_list timequeue;
extern struct event_list addqueue;
#if 0
extern struct event_list signalqueue;
#endif
struct win_fd_set {
u_int fd_count;
SOCKET fd_array[1];
};
int evsigcaught[NSIG];
volatile sig_atomic_t signal_caught = 0;
/* MSDN says this is required to handle SIGFPE */
volatile double SIGFPE_REQ = 0.0f;
#if 0
static void signal_handler(int sig);
void signal_process(void);
int signal_recalc(void);
#endif
struct event_entry {
RB_ENTRY(event_entry) node;
SOCKET sock;
int read_pos;
int write_pos;
struct event *read_event;
struct event *write_event;
};
static int
compare(struct event_entry *a, struct event_entry *b)
{
if (a->sock < b->sock)
return -1;
else if (a->sock > b->sock)
return 1;
else
return 0;
}
struct win32op {
int fd_setsz;
struct win_fd_set *readset_in;
struct win_fd_set *writeset_in;
struct win_fd_set *readset_out;
struct win_fd_set *writeset_out;
struct win_fd_set *exset_out;
RB_HEAD(event_map, event_entry) event_root;
unsigned signals_are_broken : 1;
};
RB_PROTOTYPE(event_map, event_entry, node, compare);
RB_GENERATE(event_map, event_entry, node, compare);
void *win32_init (struct event_base *);
int win32_insert (void *, struct event *);
int win32_del (void *, struct event *);
int win32_dispatch (struct event_base *base, void *, struct timeval *);
void win32_dealloc (struct event_base *, void *);
struct eventop win32ops = {
"win32",
win32_init,
win32_insert,
win32_del,
win32_dispatch,
win32_dealloc,
0
};
#define FD_SET_ALLOC_SIZE(n) ((sizeof(struct win_fd_set) + ((n)-1)*sizeof(SOCKET)))
static int
realloc_fd_sets(struct win32op *op, size_t new_size)
{
size_t size;
assert(new_size >= op->readset_in->fd_count &&
new_size >= op->writeset_in->fd_count);
assert(new_size >= 1);
size = FD_SET_ALLOC_SIZE(new_size);
if (!(op->readset_in = realloc(op->readset_in, size)))
return (-1);
if (!(op->writeset_in = realloc(op->writeset_in, size)))
return (-1);
if (!(op->readset_out = realloc(op->readset_out, size)))
return (-1);
if (!(op->exset_out = realloc(op->exset_out, size)))
return (-1);
if (!(op->writeset_out = realloc(op->writeset_out, size)))
return (-1);
op->fd_setsz = new_size;
return (0);
}
static int
timeval_to_ms(struct timeval *tv)
{
return ((tv->tv_sec * 1000) + (tv->tv_usec / 1000));
}
static struct event_entry*
get_event_entry(struct win32op *op, SOCKET s, int create)
{
struct event_entry key, *val;
key.sock = s;
val = RB_FIND(event_map, &op->event_root, &key);
if (val || !create)
return val;
if (!(val = calloc(1, sizeof(struct event_entry)))) {
event_warn("%s: calloc", __func__);
return NULL;
}
val->sock = s;
val->read_pos = val->write_pos = -1;
RB_INSERT(event_map, &op->event_root, val);
return val;
}
static int
do_fd_set(struct win32op *op, struct event_entry *ent, int read)
{
SOCKET s = ent->sock;
struct win_fd_set *set = read ? op->readset_in : op->writeset_in;
if (read) {
if (ent->read_pos >= 0)
return (0);
} else {
if (ent->write_pos >= 0)
return (0);
}
if (set->fd_count == op->fd_setsz) {
if (realloc_fd_sets(op, op->fd_setsz*2))
return (-1);
/* set pointer will have changed and needs reiniting! */
set = read ? op->readset_in : op->writeset_in;
}
set->fd_array[set->fd_count] = s;
if (read)
ent->read_pos = set->fd_count;
else
ent->write_pos = set->fd_count;
return (set->fd_count++);
}
static int
do_fd_clear(struct win32op *op, struct event_entry *ent, int read)
{
int i;
struct win_fd_set *set = read ? op->readset_in : op->writeset_in;
if (read) {
i = ent->read_pos;
ent->read_pos = -1;
} else {
i = ent->write_pos;
ent->write_pos = -1;
}
if (i < 0)
return (0);
if (--set->fd_count != i) {
struct event_entry *ent2;
SOCKET s2;
s2 = set->fd_array[i] = set->fd_array[set->fd_count];
ent2 = get_event_entry(op, s2, 0);
if (!ent) /* This indicates a bug. */
return (0);
if (read)
ent2->read_pos = i;
else
ent2->write_pos = i;
}
return (0);
}
#define NEVENT 64
void *
win32_init(struct event_base *_base)
{
struct win32op *winop;
size_t size;
if (!(winop = calloc(1, sizeof(struct win32op))))
return NULL;
winop->fd_setsz = NEVENT;
size = FD_SET_ALLOC_SIZE(NEVENT);
if (!(winop->readset_in = malloc(size)))
goto err;
if (!(winop->writeset_in = malloc(size)))
goto err;
if (!(winop->readset_out = malloc(size)))
goto err;
if (!(winop->writeset_out = malloc(size)))
goto err;
if (!(winop->exset_out = malloc(size)))
goto err;
RB_INIT(&winop->event_root);
winop->readset_in->fd_count = winop->writeset_in->fd_count = 0;
winop->readset_out->fd_count = winop->writeset_out->fd_count
= winop->exset_out->fd_count = 0;
if (evsignal_init(_base) < 0)
winop->signals_are_broken = 1;
return (winop);
err:
XFREE(winop->readset_in);
XFREE(winop->writeset_in);
XFREE(winop->readset_out);
XFREE(winop->writeset_out);
XFREE(winop->exset_out);
XFREE(winop);
return (NULL);
}
int
win32_insert(void *op, struct event *ev)
{
struct win32op *win32op = op;
struct event_entry *ent;
if (ev->ev_events & EV_SIGNAL) {
if (win32op->signals_are_broken)
return (-1);
return (evsignal_add(ev));
}
if (!(ev->ev_events & (EV_READ|EV_WRITE)))
return (0);
ent = get_event_entry(win32op, ev->ev_fd, 1);
if (!ent)
return (-1); /* out of memory */
event_debug(("%s: adding event for %d", __func__, (int)ev->ev_fd));
if (ev->ev_events & EV_READ) {
if (do_fd_set(win32op, ent, 1)<0)
return (-1);
ent->read_event = ev;
}
if (ev->ev_events & EV_WRITE) {
if (do_fd_set(win32op, ent, 0)<0)
return (-1);
ent->write_event = ev;
}
return (0);
}
int
win32_del(void *op, struct event *ev)
{
struct win32op *win32op = op;
struct event_entry *ent;
if (ev->ev_events & EV_SIGNAL)
return (evsignal_del(ev));
if (!(ent = get_event_entry(win32op, ev->ev_fd, 0)))
return (-1);
event_debug(("%s: Removing event for %d", __func__, ev->ev_fd));
if (ev == ent->read_event) {
do_fd_clear(win32op, ent, 1);
ent->read_event = NULL;
}
if (ev == ent->write_event) {
do_fd_clear(win32op, ent, 0);
ent->write_event = NULL;
}
if (!ent->read_event && !ent->write_event) {
RB_REMOVE(event_map, &win32op->event_root, ent);
free(ent);
}
return 0;
}
static void
fd_set_copy(struct win_fd_set *out, const struct win_fd_set *in)
{
out->fd_count = in->fd_count;
memcpy(out->fd_array, in->fd_array, in->fd_count * (sizeof(SOCKET)));
}
/*
static void dump_fd_set(struct win_fd_set *s)
{
unsigned int i;
printf("[ ");
for(i=0;i<s->fd_count;++i)
printf("%d ",(int)s->fd_array[i]);
printf("]\n");
}
*/
int
win32_dispatch(struct event_base *base, void *op,
struct timeval *tv)
{
struct win32op *win32op = op;
int res = 0;
unsigned j, i;
int fd_count;
SOCKET s;
struct event_entry *ent;
fd_set_copy(win32op->readset_out, win32op->readset_in);
fd_set_copy(win32op->exset_out, win32op->readset_in);
fd_set_copy(win32op->writeset_out, win32op->writeset_in);
fd_count =
(win32op->readset_out->fd_count > win32op->writeset_out->fd_count) ?
win32op->readset_out->fd_count : win32op->writeset_out->fd_count;
if (!fd_count) {
/* Windows doesn't like you to call select() with no sockets */
Sleep(timeval_to_ms(tv));
evsignal_process(base);
return (0);
}
res = select(fd_count,
(struct fd_set*)win32op->readset_out,
(struct fd_set*)win32op->writeset_out,
(struct fd_set*)win32op->exset_out, tv);
event_debug(("%s: select returned %d", __func__, res));
if(res <= 0) {
evsignal_process(base);
return res;
} else if (base->sig.evsignal_caught) {
evsignal_process(base);
}
if (win32op->readset_out->fd_count) {
i = rand() % win32op->readset_out->fd_count;
for (j=0; j<win32op->readset_out->fd_count; ++j) {
if (++i >= win32op->readset_out->fd_count)
i = 0;
s = win32op->readset_out->fd_array[i];
if ((ent = get_event_entry(win32op, s, 0)) && ent->read_event)
event_active(ent->read_event, EV_READ, 1);
}
}
if (win32op->exset_out->fd_count) {
i = rand() % win32op->exset_out->fd_count;
for (j=0; j<win32op->exset_out->fd_count; ++j) {
if (++i >= win32op->exset_out->fd_count)
i = 0;
s = win32op->exset_out->fd_array[i];
if ((ent = get_event_entry(win32op, s, 0)) && ent->read_event)
event_active(ent->read_event, EV_READ, 1);
}
}
if (win32op->writeset_out->fd_count) {
i = rand() % win32op->writeset_out->fd_count;
for (j=0; j<win32op->writeset_out->fd_count; ++j) {
if (++i >= win32op->exset_out->fd_count)
i = 0;
s = win32op->writeset_out->fd_array[i];
if ((ent = get_event_entry(win32op, s, 0)) && ent->write_event)
event_active(ent->write_event, EV_WRITE, 1);
}
}
return (0);
}
void
win32_dealloc(struct event_base *_base, void *arg)
{
struct win32op *win32op = arg;
evsignal_dealloc(_base);
if (win32op->readset_in)
free(win32op->readset_in);
if (win32op->writeset_in)
free(win32op->writeset_in);
if (win32op->readset_out)
free(win32op->readset_out);
if (win32op->writeset_out)
free(win32op->writeset_out);
if (win32op->exset_out)
free(win32op->exset_out);
/* XXXXX free the tree. */
memset(win32op, 0, sizeof(win32op));
free(win32op);
}
#if 0
static void
signal_handler(int sig)
{
evsigcaught[sig]++;
signal_caught = 1;
}
int
signal_recalc(void)
{
struct event *ev;
/* Reinstall our signal handler. */
TAILQ_FOREACH(ev, &signalqueue, ev_signal_next) {
if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1)
return (-1);
}
return (0);
}
void
signal_process(void)
{
struct event *ev;
short ncalls;
TAILQ_FOREACH(ev, &signalqueue, ev_signal_next) {
ncalls = evsigcaught[EVENT_SIGNAL(ev)];
if (ncalls) {
if (!(ev->ev_events & EV_PERSIST))
event_del(ev);
event_active(ev, EV_SIGNAL, ncalls);
}
}
memset(evsigcaught, 0, sizeof(evsigcaught));
signal_caught = 0;
}
#endif

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

@ -1,100 +0,0 @@
# Microsoft Developer Studio Project File - Name="event_test" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=event_test - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "event_test.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "event_test.mak" CFG="event_test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "event_test - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "event_test - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "event_test - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\\" /I "..\..\WIN32-Code" /I "..\..\compat" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "event_test - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\WIN32-Code" /I "..\..\compat" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "event_test - Win32 Release"
# Name "event_test - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE="..\..\sample\event-test.c"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

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

@ -1,180 +0,0 @@
Platform SDK: File Storage
ReadFile
The ReadFile function reads data from a file, starting at the position indicated by the file pointer. After the read operation has been completed, the file pointer is adjusted by the number of bytes actually read, unless the file handle is created with the overlapped attribute. If the file handle is created for overlapped input and output (I/O), the application must adjust the position of the file pointer after the read operation.
This function is designed for both synchronous and asynchronous operation. The ReadFileEx function is designed solely for asynchronous operation. It lets an application perform other processing during a file read operation.
BOOL ReadFile(
HANDLE hFile, // handle to file
LPVOID lpBuffer, // data buffer
DWORD nNumberOfBytesToRead, // number of bytes to read
LPDWORD lpNumberOfBytesRead, // number of bytes read
LPOVERLAPPED lpOverlapped // overlapped buffer
);
Parameters
hFile
[in] Handle to the file to be read. The file handle must have been created with GENERIC_READ access to the file.
Windows NT/2000/XP: For asynchronous read operations, hFile can be any handle opened with the FILE_FLAG_OVERLAPPED flag by the CreateFile function, or a socket handle returned by the socket or accept function.
Windows 95/98/Me: For asynchronous read operations, hFile can be a communications resource opened with the FILE_FLAG_OVERLAPPED flag by CreateFile, or a socket handle returned by socket or accept. You cannot perform asynchronous read operations on mailslots, named pipes, or disk files.
lpBuffer
[out] Pointer to the buffer that receives the data read from the file.
nNumberOfBytesToRead
[in] Specifies the number of bytes to be read from the file.
lpNumberOfBytesRead
[out] Pointer to the variable that receives the number of bytes read. ReadFile sets this value to zero before doing any work or error checking. If this parameter is zero when ReadFile returns TRUE on a named pipe, the other end of the message-mode pipe called the WriteFile function with nNumberOfBytesToWrite set to zero.
Windows NT/2000/XP: If lpOverlapped is NULL, lpNumberOfBytesRead cannot be NULL. If lpOverlapped is not NULL, lpNumberOfBytesRead can be NULL. If this is an overlapped read operation, you can get the number of bytes read by calling GetOverlappedResult. If hFile is associated with an I/O completion port, you can get the number of bytes read by calling GetQueuedCompletionStatus.
If I/O completion ports are used and you are using a callback routine to free the memory allocated to the OVERLAPPED structure pointed to by the lpOverlapped parameter, specify NULL as the value of this parameter to avoid a memory corruption problem during the deallocation. This memory corruption problem will cause an invalid number of bytes to be returned in this parameter.
Windows 95/98/Me: This parameter cannot be NULL.
lpOverlapped
[in] Pointer to an OVERLAPPED structure. This structure is required if hFile was created with FILE_FLAG_OVERLAPPED.
If hFile was opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must not be NULL. It must point to a valid OVERLAPPED structure. If hFile was created with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function can incorrectly report that the read operation is complete.
If hFile was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the read operation starts at the offset specified in the OVERLAPPED structure and ReadFile may return before the read operation has been completed. In this case, ReadFile returns FALSE and the GetLastError function returns ERROR_IO_PENDING. This allows the calling process to continue while the read operation finishes. The event specified in the OVERLAPPED structure is set to the signaled state upon completion of the read operation.
If hFile was not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the read operation starts at the current file position and ReadFile does not return until the operation has been completed.
Windows NT/2000/XP: If hFile is not opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the read operation starts at the offset specified in the OVERLAPPED structure. ReadFile does not return until the read operation has been completed.
Windows 95/98/Me: For operations on files, disks, pipes, or mailslots, this parameter must be NULL; a pointer to an OVERLAPPED structure causes the call to fail. However, Windows 95/98/Me supports overlapped I/O on serial and parallel ports.
Return Values
The ReadFile function returns when one of the following is true: a write operation completes on the write end of the pipe, the number of bytes requested has been read, or an error occurs.
If the function succeeds, the return value is nonzero.
If the return value is nonzero and the number of bytes read is zero, the file pointer was beyond the current end of the file at the time of the read operation. However, if the file was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, the return value is FALSE and GetLastError returns ERROR_HANDLE_EOF when the file pointer goes beyond the current end of file.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
If part of the file is locked by another process and the read operation overlaps the locked portion, this function fails.
An application must meet certain requirements when working with files opened with FILE_FLAG_NO_BUFFERING:
File access must begin at byte offsets within the file that are integer multiples of the volume's sector size. To determine a volume's sector size, call the GetDiskFreeSpace function.
File access must be for numbers of bytes that are integer multiples of the volume's sector size. For example, if the sector size is 512 bytes, an application can request reads and writes of 512, 1024, or 2048 bytes, but not of 335, 981, or 7171 bytes.
Buffer addresses for read and write operations must be sector aligned (aligned on addresses in memory that are integer multiples of the volume's sector size). One way to sector align buffers is to use the VirtualAlloc function to allocate the buffers. This function allocates memory that is aligned on addresses that are integer multiples of the system's page size. Because both page and volume sector sizes are powers of 2, memory aligned by multiples of the system's page size is also aligned by multiples of the volume's sector size.
Accessing the input buffer while a read operation is using the buffer may lead to corruption of the data read into that buffer. Applications must not read from, write to, reallocate, or free the input buffer that a read operation is using until the read operation completes.
Characters can be read from the console input buffer by using ReadFile with a handle to console input. The console mode determines the exact behavior of the ReadFile function.
If a named pipe is being read in message mode and the next message is longer than the nNumberOfBytesToRead parameter specifies, ReadFile returns FALSE and GetLastError returns ERROR_MORE_DATA. The remainder of the message may be read by a subsequent call to the ReadFile or PeekNamedPipe function.
When reading from a communications device, the behavior of ReadFile is governed by the current communication time-outs as set and retrieved using the SetCommTimeouts and GetCommTimeouts functions. Unpredictable results can occur if you fail to set the time-out values. For more information about communication time-outs, see COMMTIMEOUTS.
If ReadFile attempts to read from a mailslot whose buffer is too small, the function returns FALSE and GetLastError returns ERROR_INSUFFICIENT_BUFFER.
If the anonymous write pipe handle has been closed and ReadFile attempts to read using the corresponding anonymous read pipe handle, the function returns FALSE and GetLastError returns ERROR_BROKEN_PIPE.
The ReadFile function may fail and return ERROR_INVALID_USER_BUFFER or ERROR_NOT_ENOUGH_MEMORY whenever there are too many outstanding asynchronous I/O requests.
The ReadFile code to check for the end-of-file condition (eof) differs for synchronous and asynchronous read operations.
When a synchronous read operation reaches the end of a file, ReadFile returns TRUE and sets *lpNumberOfBytesRead to zero. The following sample code tests for end-of-file for a synchronous read operation:
// Attempt a synchronous read operation.
bResult = ReadFile(hFile, &inBuffer, nBytesToRead, &nBytesRead, NULL) ;
// Check for end of file.
if (bResult && nBytesRead == 0, )
{
// we're at the end of the file
}
An asynchronous read operation can encounter the end of a file during the initiating call to ReadFile, or during subsequent asynchronous operation.
If EOF is detected at ReadFile time for an asynchronous read operation, ReadFile returns FALSE and GetLastError returns ERROR_HANDLE_EOF.
If EOF is detected during subsequent asynchronous operation, the call to GetOverlappedResult to obtain the results of that operation returns FALSE and GetLastError returns ERROR_HANDLE_EOF.
To cancel all pending asynchronous I/O operations, use the CancelIo function. This function only cancels operations issued by the calling thread for the specified file handle. I/O operations that are canceled complete with the error ERROR_OPERATION_ABORTED.
If you are attempting to read from a floppy drive that does not have a floppy disk, the system displays a message box prompting the user to retry the operation. To prevent the system from displaying this message box, call the SetErrorMode function with SEM_NOOPENFILEERRORBOX.
The following sample code illustrates testing for end-of-file for an asynchronous read operation:
// set up overlapped structure fields
gOverLapped.Offset = 0;
gOverLapped.OffsetHigh = 0;
gOverLapped.hEvent = hEvent;
// attempt an asynchronous read operation
bResult = ReadFile(hFile, &inBuffer, nBytesToRead, &nBytesRead,
&gOverlapped) ;
// if there was a problem, or the async. operation's still pending ...
if (!bResult)
{
// deal with the error code
switch (dwError = GetLastError())
{
case ERROR_HANDLE_EOF:
{
// we have reached the end of the file
// during the call to ReadFile
// code to handle that
}
case ERROR_IO_PENDING:
{
// asynchronous i/o is still in progress
// do something else for a while
GoDoSomethingElse() ;
// check on the results of the asynchronous read
bResult = GetOverlappedResult(hFile, &gOverlapped,
&nBytesRead, FALSE) ;
// if there was a problem ...
if (!bResult)
{
// deal with the error code
switch (dwError = GetLastError())
{
case ERROR_HANDLE_EOF:
{
// we have reached the end of
// the file during asynchronous
// operation
}
// deal with other error cases
}
}
} // end case
// deal with other error cases
} // end switch
} // end if
Example Code
For an example, see Reading, Writing, and Locking Files.
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
See Also
File I/O Overview, File I/O Functions, CancelIo, CreateFile, GetCommTimeouts, GetOverlappedResult, GetQueuedCompletionStatus, OVERLAPPED, PeekNamedPipe, ReadFileEx, SetCommTimeouts, SetErrorMode, WriteFile
Platform SDK Release: November 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
See Also
File I/O Overview, File I/O Functions, CancelIo, CreateFile, GetCommTimeouts, GetOverlappedResult, GetQueuedCompletionStatus, OVERLAPPED, PeekNamedPipe, ReadFileEx, SetCommTimeouts, SetErrorMode, WriteFile

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше