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