This source file includes following definitions.
- force_quit
- init
- finalize
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 #include "orte_config.h"
  13 
  14 #include <sys/types.h>
  15 #ifdef HAVE_UNISTD_H
  16 #include <unistd.h>
  17 #endif  
  18 #include <string.h>
  19 
  20 #include "opal/util/output.h"
  21 
  22 #include "orte/runtime/orte_quit.h"
  23 #include "orte/mca/errmgr/errmgr.h"
  24 
  25 #include "orte/mca/state/state.h"
  26 #include "orte/mca/state/base/state_private.h"
  27 #include "state_tool.h"
  28 
  29 
  30 
  31 
  32 static int init(void);
  33 static int finalize(void);
  34 
  35 
  36 
  37 
  38 
  39 
  40 
  41 orte_state_base_module_t orte_state_tool_module = {
  42     init,
  43     finalize,
  44     orte_state_base_activate_job_state,
  45     orte_state_base_add_job_state,
  46     orte_state_base_set_job_state_callback,
  47     orte_state_base_set_job_state_priority,
  48     orte_state_base_remove_job_state,
  49     orte_state_base_activate_proc_state,
  50     orte_state_base_add_proc_state,
  51     orte_state_base_set_proc_state_callback,
  52     orte_state_base_set_proc_state_priority,
  53     orte_state_base_remove_proc_state
  54 };
  55 
  56 static void force_quit(int fd, short args, void *cbdata)
  57 {
  58     
  59 
  60 
  61     exit(orte_exit_status);
  62 }
  63 
  64 
  65 
  66 
  67 static int init(void)
  68 {
  69     int rc;
  70 
  71     OBJ_CONSTRUCT(&orte_job_states, opal_list_t);
  72     OBJ_CONSTRUCT(&orte_proc_states, opal_list_t);
  73 
  74     
  75     if (ORTE_SUCCESS != (rc = orte_state.add_job_state(ORTE_JOB_STATE_FORCED_EXIT,
  76                                                        force_quit, ORTE_ERROR_PRI))) {
  77         ORTE_ERROR_LOG(rc);
  78         return rc;
  79     }
  80 
  81     return ORTE_SUCCESS;
  82 }
  83 
  84 static int finalize(void)
  85 {
  86     opal_list_item_t *item;
  87 
  88     
  89     while (NULL != (item = opal_list_remove_first(&orte_proc_states))) {
  90         OBJ_RELEASE(item);
  91     }
  92     OBJ_DESTRUCT(&orte_proc_states);
  93 
  94     while (NULL != (item = opal_list_remove_first(&orte_job_states))) {
  95         OBJ_RELEASE(item);
  96     }
  97     OBJ_DESTRUCT(&orte_job_states);
  98 
  99     return ORTE_SUCCESS;
 100 }