1 /* 2 * Copyright (c) 2014 Intel, Inc. All rights reserved. 3 * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. 4 * $COPYRIGHT$ 5 * 6 * Additional copyrights may follow 7 * 8 * $HEADER$ 9 */ 10 11 #ifndef OPAL_PROGRESS_THREADS_H 12 #define OPAL_PROGRESS_THREADS_H 13 14 #include "opal_config.h" 15 16 #include "opal/mca/event/event.h" 17 18 19 /** 20 * Initialize a progress thread name; if a progress thread is not 21 * already associated with that name, start a progress thread. 22 * 23 * If you have general events that need to run in *a* progress thread 24 * (but not necessarily a your own, dedicated progress thread), pass 25 * NULL the "name" argument to the opal_progress_thead_init() function 26 * to glom on to the general OPAL-wide progress thread. 27 * 28 * If a name is passed that was already used in a prior call to 29 * opal_progress_thread_init(), the event base associated with that 30 * already-running progress thread will be returned (i.e., no new 31 * progress thread will be started). 32 */ 33 OPAL_DECLSPEC opal_event_base_t *opal_progress_thread_init(const char *name); 34 35 /** 36 * Finalize a progress thread name (reference counted). 37 * 38 * Once this function is invoked as many times as 39 * opal_progress_thread_init() was invoked on this name (or NULL), the 40 * progress function is shut down and the event base associated with 41 * it is destroyed. 42 * 43 * Will return OPAL_ERR_NOT_FOUND if the progress thread name does not 44 * exist; OPAL_SUCCESS otherwise. 45 */ 46 OPAL_DECLSPEC int opal_progress_thread_finalize(const char *name); 47 48 /** 49 * Temporarily pause the progress thread associated with this name. 50 * 51 * This function does not destroy the event base associated with this 52 * progress thread name, but it does stop processing all events on 53 * that event base until opal_progress_thread_resume() is invoked on 54 * that name. 55 * 56 * Will return OPAL_ERR_NOT_FOUND if the progress thread name does not 57 * exist; OPAL_SUCCESS otherwise. 58 */ 59 OPAL_DECLSPEC int opal_progress_thread_pause(const char *name); 60 61 /** 62 * Restart a previously-paused progress thread associated with this 63 * name. 64 * 65 * Will return OPAL_ERR_NOT_FOUND if the progress thread name does not 66 * exist; OPAL_SUCCESS otherwise. 67 */ 68 OPAL_DECLSPEC int opal_progress_thread_resume(const char *name); 69 70 #endif