2004-09-26 21:43:35 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* 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.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-09-26 21:43:35 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*
|
|
|
|
* Interface for waitpid / async notification of child death with the
|
|
|
|
* libevent runtime system.
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
#ifndef ORTE_WAIT_H
|
|
|
|
#define ORTE_WAIT_H
|
2004-09-26 21:43:35 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
#include "orte_config.h"
|
2004-09-26 21:43:35 +04:00
|
|
|
|
2004-10-20 05:03:09 +04:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
2004-09-26 21:43:35 +04:00
|
|
|
#include <sys/types.h>
|
2004-10-20 05:03:09 +04:00
|
|
|
#endif
|
2004-09-26 21:43:35 +04:00
|
|
|
|
|
|
|
/** typedef for callback function used in \c ompi_rte_wait_cb */
|
2005-03-14 23:57:21 +03:00
|
|
|
typedef void (*orte_wait_fn_t)(pid_t wpid, int status, void *data);
|
2004-09-26 21:43:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wait for process terminiation
|
|
|
|
*
|
2005-03-14 23:57:21 +03:00
|
|
|
* Similar to \c waitpid, \c orte_waitpid utilizes the run-time
|
2004-09-26 21:43:35 +04:00
|
|
|
* event library for process terminiation notification. The \c
|
|
|
|
* WUNTRACED option is not supported, but the \c WNOHANG option is
|
|
|
|
* supported.
|
|
|
|
*
|
|
|
|
* \note A \c wpid value of \c -1 is not currently supported and will
|
|
|
|
* return an error.
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
pid_t orte_waitpid(pid_t wpid, int *status, int options);
|
2004-09-26 21:43:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a callback for process termination
|
|
|
|
*
|
|
|
|
* Register a callback for notification when \c wpid causes a SIGCHLD.
|
|
|
|
* \c waitpid() will have already been called on the process at this
|
|
|
|
* time.
|
|
|
|
*
|
|
|
|
* If a thread is already blocked in \c ompi_rte_waitpid for \c wpid,
|
2006-02-12 04:33:29 +03:00
|
|
|
* this function will return \c ORTE_ERR_EXISTS. It is illegal for
|
2005-03-18 06:43:59 +03:00
|
|
|
* multiple callbacks to be registered for a single \c wpid
|
|
|
|
* (OMPI_EXISTS will be returned in this case).
|
2004-09-26 21:43:35 +04:00
|
|
|
*
|
|
|
|
* \warning It is not legal for \c wpid to be -1 when registering a
|
|
|
|
* callback.
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_wait_cb(pid_t wpid, orte_wait_fn_t callback, void *data);
|
2004-09-26 21:43:35 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_wait_cb_cancel(pid_t wpid);
|
2004-10-27 02:11:03 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_wait_cb_disable(void);
|
2004-10-27 02:11:03 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_wait_cb_enable(void);
|
2004-09-26 21:43:35 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \internal
|
|
|
|
*
|
|
|
|
* Initialize the wait system (allocate mutexes, etc.)
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_wait_init(void);
|
2004-09-26 21:43:35 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
/**
|
|
|
|
* Kill all processes we are waiting on.
|
|
|
|
*/
|
|
|
|
int orte_wait_kill(int sig);
|
2004-09-26 21:43:35 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \internal
|
|
|
|
*
|
|
|
|
* Finalize the wait system (deallocate mutexes, etc.)
|
|
|
|
*/
|
2005-03-14 23:57:21 +03:00
|
|
|
int orte_wait_finalize(void);
|
2004-09-26 21:43:35 +04:00
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
#endif /* #ifndef ORTE_WAIT_H */
|