diff --git a/opal/event/event.c b/opal/event/event.c index ec30d9c604..cde730477a 100644 --- a/opal/event/event.c +++ b/opal/event/event.c @@ -68,37 +68,22 @@ #if defined(HAVE_SELECT) && HAVE_SELECT extern const struct opal_eventop opal_selectops; -#ifndef OPAL_HAVE_WORKING_EVENTOPS -#define OPAL_HAVE_WORKING_EVENTOPS 1 -#endif #endif #if defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL extern const struct opal_eventop opal_pollops; -#ifndef OPAL_HAVE_WORKING_EVENTOPS -#define OPAL_HAVE_WORKING_EVENTOPS 1 -#endif #endif #if defined(HAVE_RTSIG) && HAVE_RTSIG extern const struct opal_eventop opal_rtsigops; -#ifndef OPAL_HAVE_WORKING_EVENTOPS -#define OPAL_HAVE_WORKING_EVENTOPS 1 -#endif #endif #if defined(HAVE_EPOLL) && HAVE_EPOLL extern const struct opal_eventop opal_epollops; -#ifndef OPAL_HAVE_WORKING_EVENTOPS -#define OPAL_HAVE_WORKING_EVENTOPS 1 -#endif #endif #if defined(HAVE_WORKING_KQUEUE) && HAVE_WORKING_KQUEUE extern const struct opal_eventop opal_kqops; -#ifndef OPAL_HAVE_WORKING_EVENTOPS -#define OPAL_HAVE_WORKING_EVENTOPS 1 -#endif #endif #if 0 @@ -108,15 +93,8 @@ extern const struct opal_eventop opal_kqops; this to work */ #if defined(WIN32) && WIN32 extern const struct opal_eventop opal_win32ops; -#ifndef OPAL_HAVE_WORKING_EVENTOPS -#define OPAL_HAVE_WORKING_EVENTOPS 1 #endif #endif -#endif - -#ifndef OPAL_HAVE_WORKING_EVENTOPS -#define OPAL_HAVE_WORKING_EVENTOPS 0 -#endif /* In order of preference */ static const struct opal_eventop *opal_eventops[] = { diff --git a/opal/event/event.h b/opal/event/event.h index bfdf10b91d..922f1b9a6e 100644 --- a/opal/event/event.h +++ b/opal/event/event.h @@ -284,4 +284,20 @@ opal_event_pending(struct opal_event *ev, short event, struct timeval *tv) } #endif +/* #defines to allow callers to know if opal_event_loop is going to do anything */ + +#if defined(HAVE_SELECT) && HAVE_SELECT +#define OPAL_HAVE_WORKING_EVENTOPS 1 +#elif defined(HAVE_POLL) && HAVE_POLL && HAVE_WORKING_POLL +#define OPAL_HAVE_WORKING_EVENTOPS 1 +#elif defined(HAVE_RTSIG) && HAVE_RTSIG +#define OPAL_HAVE_WORKING_EVENTOPS 1 +#elif defined(HAVE_EPOLL) && HAVE_EPOLL +#define OPAL_HAVE_WORKING_EVENTOPS 1 +#elif defined(HAVE_WORKING_KQUEUE) && HAVE_WORKING_KQUEUE +#define OPAL_HAVE_WORKING_EVENTOPS 1 +#else +#define OPAL_HAVE_WORKING_EVENTOPS 0 +#endif + #endif /* _EVENT_H_ */ diff --git a/opal/runtime/opal_progress.c b/opal/runtime/opal_progress.c index e796b94b3a..57d1f18be9 100644 --- a/opal/runtime/opal_progress.c +++ b/opal/runtime/opal_progress.c @@ -179,7 +179,7 @@ opal_progress_events(int flag) * This is only losely tracked, as an error return can cause the number * of progressed events to appear lower than it actually is. We don't * care, as the cost of that happening is far outweighed by the cost - * of the if checks (they were resulting in bad pipe stalling behabior) + * of the if checks (they were resulting in bad pipe stalling behavior) */ void opal_progress(void) @@ -187,7 +187,7 @@ opal_progress(void) size_t i; int events = 0; -#if OMPI_ENABLE_PROGRESS_THREADS == 0 +#if (OMPI_ENABLE_PROGRESS_THREADS == 0) && OPAL_HAVE_WORKING_EVENTOPS /* trip the event library if we've reached our tick rate and we are enabled */ if (OPAL_THREAD_ADD32(&event_progress_counter, -1) <= 0 && @@ -203,7 +203,7 @@ opal_progress(void) } #endif /* OMPI_HAVE_THREAD_SUPPORT */ } -#endif /* OMPI_ENABLE_PROGRESS_THREADS == 0 */ +#endif /* OMPI_ENABLE_PROGRESS_THREADS == 0 && OPAL_HAVE_WORKING_EVENTOPS */ /* progress all registered callbacks */ for (i = 0 ; i < callbacks_len ; ++i) {