Open Lighting Architecture  0.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SchedulerInterface.h
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * SchedulerInterface.h
17  * The scheduler interface provides methods to schedule the execution of
18  * callbacks at some point in the future.
19  * Copyright (C) 2011 Simon Newton
20  */
21 
22 #ifndef INCLUDE_OLA_THREAD_SCHEDULERINTERFACE_H_
23 #define INCLUDE_OLA_THREAD_SCHEDULERINTERFACE_H_
24 
25 #include <ola/Callback.h>
26 #include <ola/Clock.h>
27 
28 namespace ola {
29 namespace thread {
30 
31 typedef void* timeout_id;
32 static const timeout_id INVALID_TIMEOUT = NULL;
33 
34 
36  public :
38  virtual ~SchedulerInterface() {}
39 
40  virtual timeout_id RegisterRepeatingTimeout(
41  unsigned int ms,
42  Callback0<bool> *closure) = 0;
43  virtual timeout_id RegisterRepeatingTimeout(
44  const ola::TimeInterval &interval,
45  Callback0<bool> *closure) = 0;
46 
47  virtual timeout_id RegisterSingleTimeout(
48  unsigned int ms,
49  SingleUseCallback0<void> *closure) = 0;
50  virtual timeout_id RegisterSingleTimeout(
51  const ola::TimeInterval &interval,
52  SingleUseCallback0<void> *closure) = 0;
53 
54  virtual void RemoveTimeout(timeout_id id) = 0;
55 };
56 } // namespace thread
57 } // namespace ola
58 #endif // INCLUDE_OLA_THREAD_SCHEDULERINTERFACE_H_