]> Dogcows Code - chaz/tint2/blobdiff - src/util/timer.h
*add* more task states (normal, active, iconified, urgent), with each an own backgrou...
[chaz/tint2] / src / util / timer.h
index df06fc3453ce7e3b879d2e16debd795bf71786c2..22a5ee3607334ef222c11fd25f945fba308fa0c9 100644 (file)
@@ -25,30 +25,36 @@ extern GSList* timeout_list;
 extern struct timeval next_timeout;
 
 
-struct timeout {
-       int interval_msec;
-       struct timespec timeout_expires;
-       void (*_callback)(void*);
-       void* arg;
-       void* multi_timeout;
-};
+typedef struct _timeout timeout;
 
 
 // timer functions
+/**
+  * Single shot timer (i.e. timer with interval_msec == 0) are deleted automatically as soon as they expire
+  * i.e. you do not need to stop them, however it is safe to call stop_timeout for these timers.
+  * Periodic timeouts are aligned to each other whenever possible, i.e. one interval_msec is an
+  * integral multiple of the other.
+**/
+
 /** installs a timeout with the first timeout of 'value_msec' and then a periodic timeout with
-       * 'interval_msec'. '_callback' is the callback function when the timer reaches the timeout.
-       * returns a pointer to the timeout, which is needed for stopping it again **/
-const struct timeout* add_timeout(int value_msec, int interval_msec, void (*_callback)(void*), void* arg);
+  * 'interval_msec'. '_callback' is the callback function when the timer reaches the timeout.
+  * returns a pointer to the timeout, which is needed for stopping it again
+**/
+timeout* add_timeout(int value_msec, int interval_msec, void (*_callback)(void*), void* arg);
 
-void change_timeout(const struct timeout* t, int value_msec, int interval_msec, void (*_callback)(void*), void* arg);
+/** changes timeout 't'. If timeout 't' does not exist, nothing happens **/
+void change_timeout(timeout* t, int value_msec, int interval_msec, void (*_callback)(void*), void* arg);
 
 /** stops the timeout 't' **/
-void stop_timeout(const struct timeout* t);
+void stop_timeout(timeout* t);
 
 /** stops all timeouts **/
 void stop_all_timeouts();
 
+/** update_next_timeout updates next_timeout to the value, when the next installed timeout will expire **/
 void update_next_timeout();
+
+/** Callback of all expired timeouts **/
 void callback_timeout_expired();
 
 #endif // TIMER_H
This page took 0.023143 seconds and 4 git commands to generate.