#ifndef _UCW_MAINLOOP_H
#define _UCW_MAINLOOP_H
-#include "ucw/clists.h"
+#include <ucw/clists.h>
+#include <ucw/process.h>
#include <signal.h>
/** The main loop context **/
struct main_context {
- timestamp_t now; /* [*] Current time in milliseconds since the UNIX epoch. See main_get_time(). */
- ucw_time_t now_seconds; /* [*] Current time in seconds since the epoch. */
+ timestamp_t now; /* [*] Current time in milliseconds since an unknown epoch. See main_get_time(). */
timestamp_t idle_time; /* [*] Total time in milliseconds spent by waiting for events. */
uns shutdown; /* [*] Setting this to nonzero forces the main_loop() function to terminate. */
clist file_list;
/**
* Show the current state of a given context (use @main_debug() for the current context).
- * Available only if LibUCW has been compiled with `CONFIG_DEBUG`.
+ * Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`.
**/
void main_debug_context(struct main_context *m);
return main_current()->now;
}
-/** An analog of @main_get_now() returning the number of seconds since the system epoch. **/
-static inline ucw_time_t main_get_now_seconds(void)
-{
- return main_current()->now_seconds;
-}
-
/**
* This is a description of a timer.
* You define the handler function and possibly user-defined data you wish
* timer. It is permitted (and usual) to call this function from the
* timer's handler itself if you want the timer to trigger again.
*
- * The @expire parameter is absolute, use @timer_add_rel() for a relative version.
+ * The @expire parameter is absolute (in the same time scale as @main_get_now()),
+ * use @timer_add_rel() for a relative version.
**/
void timer_add(struct main_timer *tm, timestamp_t expires);
**/
void main_get_time(void);
-/** Show current state of a timer. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a timer. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
void timer_debug(struct main_timer *tm);
/***
return clist_is_linked(&ho->n);
}
-/** Show current state of a hook. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a hook. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
void hook_debug(struct main_hook *ho);
return clist_is_linked(&fi->n);
}
-/** Show current state of a file. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a file. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
void file_debug(struct main_file *fi);
/***
return clist_is_linked(&mp->n);
}
-/** Show current state of a process. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a process. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
void process_debug(struct main_process *pr);
/***
return clist_is_linked(&ms->n);
}
-/** Show current state of a signal catcher. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a signal catcher. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
void signal_debug(struct main_signal *sg);
#endif