X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fmainloop.h;h=f321c2b5fc85e57402d1a4c2741b1deea26f2bcd;hb=d1a5b69d490ce61a0f41db08263580487720bf2f;hp=a8626f0345c2672ef20883cb2edd2e2b6b05d83b;hpb=c29017ebe753d461771cc7a1f1878c7920ea23ea;p=libucw.git diff --git a/lib/mainloop.h b/lib/mainloop.h index a8626f03..f321c2b5 100644 --- a/lib/mainloop.h +++ b/lib/mainloop.h @@ -71,10 +71,17 @@ void file_close_all(void); /* Close all known main_file's; frequently used bef struct main_hook { cnode n; - int (*handler)(struct main_hook *ho); /* [*] Hook function; returns 1 if should be called again */ + int (*handler)(struct main_hook *ho); /* [*] Hook function; returns HOOK_xxx */ void *data; /* [*] For use by the handler */ }; +enum main_hook_return { + HOOK_IDLE, /* Call again when the main loop becomes idle again */ + HOOK_RETRY, /* Call again as soon as possible */ + HOOK_DONE = -1, /* Shut down the main loop if all hooks return this value */ + HOOK_SHUTDOWN = -2 /* Shut down the main loop immediately */ +}; + void hook_add(struct main_hook *ho); void hook_del(struct main_hook *ho); @@ -96,7 +103,7 @@ int process_fork(struct main_process *mp); /* The main loop */ void main_init(void); -int main_loop(void); +void main_loop(void); void main_debug(void); #endif