Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Connect the m_datatypes_management_details doxygen module into the tree
[simgrid.git] / include / gras / timer.h
1 /* $Id$ */
2
3 /* timer - delayed and repetitive tasks                                     */
4 /* module's public interface exported to end user.                          */
5
6 /* Copyright (c) 2005 Martin Quinson. All rights reserved.                  */
7
8 /* This program is free software; you can redistribute it and/or modify it
9  * under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #ifndef GRAS_TIMER_H
12 #define GRAS_TIMER_H
13
14 #include "xbt/misc.h"
15
16 SG_BEGIN_DECL()
17
18 /** @addtogroup GRAS_timer
19  *  @brief Delayed and repetitive tasks (Communication facility)
20  *
21  * <center><table><tr><td><b>Top</b>    <td> [\ref index]::[\ref GRAS_API]
22  *                <tr><td><b>Prev</b>   <td> [\ref GRAS_msg]
23  *                <tr><td><b>Next</b>   <td> [\ref GRAS_virtu]            </table></center>
24  *
25  *  This is how to have a specific function called only once after the
26  *  specified amount of time or a function executed every 5 mn until it gets 
27  *  removed. In the UNIX world, this is comparable to <tt>at</tt> and 
28  *  <tt>cron</tt>.
29  *
30  *  Note that this is very soft timers: the execution of the processes won't
31  *  get interrupted at all. This is on purpose: the GRAS programming model
32  *  is distributed sequential, so that users don't have to deal with mutexes
33  *  and such within a specific process.
34  *
35  *  Timers are served by the gras_handle() function: if there is an elapsed 
36  *  timer, the associated code gets executed before any incomming connexion 
37  *  are checked. 
38  *
39  *  The section \ref GRAS_ex_timer constitutes a perfect example of these features.
40  * 
41  *  @{
42  */
43
44   typedef void (*void_f_void_t)(void);
45
46   void gras_timer_delay(double delay, void_f_void_t action);
47   void gras_timer_repeat(double interval, void_f_void_t action);
48
49   void gras_timer_cancel_delay(double interval, void_f_void_t action);
50   void gras_timer_cancel_repeat(double interval, void_f_void_t action);
51
52   void gras_timer_cancel_delay_all(void);
53   void gras_timer_cancel_repeat_all(void);
54
55   void gras_timer_cancel_all(void);
56
57 /** @} */
58
59 SG_END_DECL()
60
61 #endif /* GRAS_TIMER_H */