1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/*
* Copyright (c) 2008 Cisco, Inc. All rights reserved.
* Copyright (c) 2009 Sandia National Laboratories. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OMPI_BTL_OPENIB_FD_H_
#define OMPI_BTL_OPENIB_FD_H_
#include "ompi_config.h"
BEGIN_C_DECLS
/**
* Typedef for fd callback function
*/
typedef void *(ompi_btl_openib_fd_event_callback_fn_t)(int fd, int flags,
void *context);
/**
* Typedef for generic callback function
*/
typedef void *(ompi_btl_openib_fd_main_callback_fn_t)(void *context);
/**
* Initialize fd monitoring.
* Called by the main thread.
*/
int ompi_btl_openib_fd_init(void);
/**
* Start monitoring an fd.
* Called by main or service thread; callback will be in service thread.
*/
int ompi_btl_openib_fd_monitor(int fd, int flags,
ompi_btl_openib_fd_event_callback_fn_t *callback,
void *context);
/**
* Stop monitoring an fd.
* Called by main or service thread; callback will be in service thread.
*/
int ompi_btl_openib_fd_unmonitor(int fd,
ompi_btl_openib_fd_event_callback_fn_t *callback,
void *context);
/**
* Run a function in the service thread.
* Called by the main thread.
*/
int ompi_btl_openib_fd_run_in_service(ompi_btl_openib_fd_main_callback_fn_t callback,
void *context);
/**
* Run a function in the main thread.
* Called by the service thread.
*/
int ompi_btl_openib_fd_run_in_main(ompi_btl_openib_fd_main_callback_fn_t callback,
void *context);
/**
* Drain all pending messages from the main thread's pipe.
* Likely only useful during finalize, when the event library
* won't fire callbacks.
*/
int ompi_btl_openib_fd_main_thread_drain(void);
/**
* Finalize fd monitoring.
* Called by the main thread.
*/
int ompi_btl_openib_fd_finalize(void);
END_C_DECLS
#endif
|