moved the token invalidation from ~trackable to signal_base::do_disconnect where...
[beacon-ss.git] / beacon / future_event.hpp
blob0e30215fb6db01873744c486d1134997d1d6bc35
1 /**
2 * beacon
3 * Author: Lukas Krejci <krejci.l@centrum.cz>, (C) 2008
4 * Copyright: See COPYING file that comes with this distribution
5 */
7 #ifndef BEACON_FUTURE_EVENT_H
8 #define BEACON_FUTURE_EVENT_H
10 #include <beacon/future.hpp>
11 #include <beacon/detail/future_event_base.hpp>
13 namespace beacon {
15 /**
16 * An implementation of the future interface that cooperates with
17 * {@link event_loop}.
19 template<typename ResultType>
20 class future_event : public future<ResultType>, public detail::future_event_base {
21 public:
23 future_event() : future_event_base() {
26 /** currently always fails returning false */
27 bool cancel() {
28 return this->future_event_base::cancel();
31 bool finished() const {
32 return this->future_event_base::finished();
35 ResultType get() throw (execution_exception) {
36 return static_cast<ResultType>(*(this->future_event_base::get()));
39 ResultType get(int timeout) throw(execution_exception, timeout_exception) {
40 return static_cast<ResultType>(*(this->future_event_base::get(timeout)));
44 template<>
45 class future_event<void> : public future<void>, public detail::future_event_base {
46 public:
48 future_event() : future_event_base() {
51 /** currently always fails returning false */
52 bool cancel() {
53 return this->future_event_base::cancel();
56 bool finished() const {
57 return this->future_event_base::finished();
60 void get() throw (execution_exception) {
61 this->future_event_base::get();
64 void get(int timeout) throw(execution_exception, timeout_exception) {
65 this->future_event_base::get();
71 #endif