If dispatch returns: * -1: Job running but not complete * 0: Remove the trigger from mainloop * 1: Leave the trigger in mainloop */
| 155 | * 1: Leave the trigger in mainloop |
| 156 | */ |
| 157 | crm_trigger_t * |
| 158 | mainloop_add_trigger(int priority, int(*dispatch) (gpointer user_data), gpointer userdata) |
| 159 | { |
| 160 | GSource *source = NULL; |
| 161 | |
| 162 | CRM_ASSERT(sizeof(crm_trigger_t) > sizeof(GSource)); |
| 163 | source = g_source_new(&crm_trigger_funcs, sizeof(crm_trigger_t)); |
| 164 | CRM_ASSERT(source != NULL); |
| 165 | |
| 166 | return mainloop_setup_trigger(source, priority, dispatch, userdata); |
| 167 | } |
| 168 | |
| 169 | void |
| 170 | mainloop_set_trigger(crm_trigger_t * source) |