struct main_context *m = main_current();
DBG("MAIN: Adding hook %p", ho);
- if (!hook_is_active(ho))
- clist_add_tail(&m->hook_list, &ho->n);
+ if (hook_is_active(ho))
+ clist_unlink(&ho->n);
+ clist_add_tail(&m->hook_list, &ho->n);
}
void
* Inserts a new hook into the loop.
* The hook will be scheduled at least once before next sleep.
* May be called from inside a hook handler too.
- * Adding an already added hook does nothing.
+ * Adding an already added hook is permitted and if the hook has been run,
+ * it will be run again before next sleep.
**/
void hook_add(struct main_hook *ho);