30 #include "orte_config.h"
32 #ifdef HAVE_SYS_TYPES_H
33 #include <sys/types.h>
35 #ifdef HAVE_SYS_TIME_H
42 #include "opal/mca/event/event.h"
68 ORTE_DECLSPEC
void orte_wait_disable(
void);
81 ORTE_DECLSPEC pid_t
orte_waitpid(pid_t wpid,
int *status,
int options);
101 ORTE_DECLSPEC
int orte_wait_cb_cancel(pid_t wpid);
103 ORTE_DECLSPEC
int orte_wait_cb_disable(
void);
105 ORTE_DECLSPEC
int orte_wait_cb_enable(
void);
123 void (*cbfunc)(
int,
short,
void*));
134 #define ORTE_PROGRESSED_WAIT(failed, counter, limit) \
136 OPAL_OUTPUT_VERBOSE((1, orte_debug_output, \
137 "progressed_wait: %s %d", \
138 __FILE__, __LINE__)); \
139 while (!(failed) && (counter) < (limit)) { \
177 #if OPAL_ENABLE_DEBUG
184 #define ORTE_MESSAGE_EVENT_DELAY(delay, mev) \
186 struct timeval now; \
187 OPAL_OUTPUT_VERBOSE((1, orte_debug_output, \
188 "defining message event delay: %s %d", \
189 __FILE__, __LINE__)); \
190 now.tv_sec = delay/1000000; \
191 now.tv_usec = delay%1000000; \
192 opal_event_evtimer_add(mev->ev, &now); \
195 #if OPAL_ENABLE_DEBUG
197 #define ORTE_MESSAGE_EVENT(sndr, buf, tg, cbfunc) \
199 orte_message_event_t *mev; \
200 struct timeval now; \
201 OPAL_OUTPUT_VERBOSE((1, orte_debug_output, \
202 "defining message event: %s %d", \
203 __FILE__, __LINE__)); \
204 mev = OBJ_NEW(orte_message_event_t); \
205 mev->sender.jobid = (sndr)->jobid; \
206 mev->sender.vpid = (sndr)->vpid; \
207 ORTE_EPOCH_SET(mev->sender.epoch,(sndr)->epoch); \
208 opal_dss.copy_payload(mev->buffer, (buf)); \
210 mev->file = strdup((buf)->parent.cls_init_file_name); \
211 mev->line = (buf)->parent.cls_init_lineno; \
212 opal_event_evtimer_set(opal_event_base, \
213 mev->ev, (cbfunc), mev); \
216 opal_event_evtimer_add(mev->ev, &now); \
221 #define ORTE_MESSAGE_EVENT(sndr, buf, tg, cbfunc) \
223 orte_message_event_t *mev; \
224 struct timeval now; \
225 OPAL_OUTPUT_VERBOSE((1, orte_debug_output, \
226 "defining message event: %s %d", \
227 __FILE__, __LINE__)); \
228 mev = OBJ_NEW(orte_message_event_t); \
229 mev->sender.jobid = (sndr)->jobid; \
230 mev->sender.vpid = (sndr)->vpid; \
231 ORTE_EPOCH_SET(mev->sender.epoch,(sndr)->epoch); \
232 opal_dss.copy_payload(mev->buffer, (buf)); \
234 opal_event_evtimer_set(opal_event_base, \
235 mev->ev, (cbfunc), mev); \
238 opal_event_evtimer_add(mev->ev, &now); \
254 #define ORTE_NOTIFY_EVENT(cbfunc, data) \
256 struct timeval now; \
257 orte_notify_event_t *tmp; \
258 tmp = OBJ_NEW(orte_notify_event_t); \
259 tmp->proc.jobid = (data)->jobid; \
260 tmp->proc.vpid = (data)->vpid; \
261 ORTE_EPOCH_SET(tmp->proc.epoch,(data)->epoch); \
262 opal_event.evtimer_set(opal_event_base, \
263 tmp->ev, (cbfunc), tmp); \
266 OPAL_OUTPUT_VERBOSE((1, orte_debug_output, \
267 "defining notify event at %s:%d", \
268 __FILE__, __LINE__)); \
269 opal_event_evtimer_add(tmp->ev, &now); \
288 #define ORTE_DETECT_TIMEOUT(event, n, deltat, maxwait, cbfunc) \
290 struct timeval now; \
293 tmp = (opal_event_t *) malloc(sizeof(opal_event_t)); \
294 opal_event_evtimer_set(opal_event_base, \
295 tmp, (cbfunc), tmp); \
296 timeout = (deltat) * (n); \
297 if ((maxwait) > 0 && timeout > (maxwait)) { \
298 timeout = (maxwait); \
300 now.tv_sec = timeout/1000000; \
301 now.tv_usec = timeout%1000000; \
302 OPAL_OUTPUT_VERBOSE((1, orte_debug_output, \
303 "defining timeout: %ld sec %ld usec at %s:%d", \
304 (long)now.tv_sec, (long)now.tv_usec, \
305 __FILE__, __LINE__)); \
306 opal_event_evtimer_add(tmp, &now); \
316 #define ORTE_TIMER_EVENT(sec, usec, cbfunc) \
318 struct timeval now; \
320 tmp = (opal_event_t *) malloc(sizeof(opal_event_t)); \
321 opal_event_evtimer_set(opal_event_base, \
322 tmp, (cbfunc), tmp); \
323 now.tv_sec = (sec); \
324 now.tv_usec = (usec); \
325 OPAL_OUTPUT_VERBOSE((1, orte_debug_output, \
326 "defining timer event: %ld sec %ld usec at %s:%d", \
327 (long)now.tv_sec, (long)now.tv_usec, \
328 __FILE__, __LINE__)); \
329 opal_event_evtimer_add(tmp, &now); \
338 ORTE_DECLSPEC
int orte_wait_init(
void);
350 ORTE_DECLSPEC
int orte_wait_finalize(
void);
Progress engine for Open MPI.
OPAL output stream facility.
Structure to represent a single event.
Definition: event_struct.h:87
ORTE_DECLSPEC int orte_wait_kill(int sig)
Kill all processes we are waiting on.
Definition: orte_wait.c:1172
Volatile lock object (with optional padding).
Definition: atomic.h:102
Setup an event to process a message.
Definition: orte_wait.h:171
ORTE_DECLSPEC pid_t orte_waitpid(pid_t wpid, int *status, int options)
Wait for process terminiation.
Definition: orte_wait.c:1130
void(* orte_wait_fn_t)(pid_t wpid, int status, void *data)
typedef for callback function used in ompi_rte_wait_cb
Definition: orte_wait.h:59
Base object.
Definition: opal_object.h:182
Definition: orte_wait.h:247
uint32_t orte_rml_tag_t
Message matching tag.
Definition: rml_types.h:220
ORTE_DECLSPEC void orte_trigger_event(orte_trigger_event_t *trig)
Trigger a defined event.
Definition: orte_wait.c:1159
ORTE_DECLSPEC int orte_wait_cb(pid_t wpid, orte_wait_fn_t callback, void *data)
Register a callback for process termination.
Definition: orte_wait.c:1136
Structure for holding a buffer to be used with the RML or OOB subsystems.
Definition: dss_types.h:159
Definition: orte_wait.h:50
Contains the typedefs for the use of the rml.
ORTE_DECLSPEC void orte_wait_enable(void)
Disable / re-Enable SIGCHLD handler.
ORTE_DECLSPEC int orte_wait_event(opal_event_t **event, orte_trigger_event_t *trig, char *trigger_name, void(*cbfunc)(int, short, void *))
Setup to wait for an event.
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236