CppCMS

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

deadline_timer.h
1 //
2 // Copyright (C) 2009-2012 Artyom Beilis (Tonkikh)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 #ifndef BOOSTER_AIO_DEADLINE_TIMER_H
9 #define BOOSTER_AIO_DEADLINE_TIMER_H
10
11 #include <booster/config.h>
12 #include <booster/posix_time.h>
13 #include <booster/hold_ptr.h>
14 #include <booster/callback.h>
15 #include <booster/aio/types.h>
16 #include <booster/noncopyable.h>
17
18 namespace booster {
19 namespace aio {
20
24 class BOOSTER_API deadline_timer : public noncopyable {
25 public:
29 deadline_timer();
30
34 deadline_timer(io_service &srv);
35 ~deadline_timer();
36
40 io_service &get_io_service();
44 void set_io_service(io_service &srv);
48 void reset_io_service();
49
55 void expires_from_now(ptime t);
59 ptime expires_from_now();
60
66 void expires_at(ptime t);
70 ptime expires_at();
71
75 void wait();
81 void async_wait(event_handler const &h);
88 void cancel();
89 private:
90 struct waiter;
91 friend struct waiter;
92
93 struct data;
94 hold_ptr<data> d;
95
96 io_service *srv_;
97 ptime deadline_;
98 int event_id_;
99
100 };
101
102 } // aio
103 } // booster
104
105
106
107 #endif
booster::hold_ptr< data >
booster::aio::deadline_timer
A timer object.
Definition: deadline_timer.h:24
booster::callback
Definition: callback.h:18
booster::ptime
This class represents POSIX time.
Definition: posix_time.h:26
booster
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23
booster::aio::io_service
this is the central event loop that dispatches all requests.
Definition: io_service.h:37
booster::noncopyable
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15