Changeset 0d299c93 in mainline
- Timestamp:
- 2019-07-01T14:50:41Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0fc6b6c
- Parents:
- 0f43be5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/__bits/thread/future.hpp
r0f43be5 r0d299c93 43 43 namespace aux 44 44 { 45 /** 46 * Note: Because of shared_future, this base class 47 * does implement copy constructor and copy 48 * assignment operator. This means that the 49 * children (std::future) need to delete this 50 * constructor and operator themselves. 51 */ 45 52 template<class R> 46 53 class future_base … … 51 58 { /* DUMMY BODY */ } 52 59 53 future_base(const future_base&) = delete; 60 future_base(const future_base& rhs) 61 : state_{rhs.state_} 62 { 63 state_->increment(); 64 } 54 65 55 66 future_base(future_base&& rhs) noexcept … … 75 86 } 76 87 77 future_base& operator=(const future_base&) = delete; 88 future_base& operator=(const future_base& rhs) 89 { 90 release_state_(); 91 state_ = rhs.state_; 92 93 state_->increment(); 94 95 return *this; 96 } 78 97 79 98 future_base& operator=(future_base&& rhs) noexcept … … 154 173 class future: public aux::future_base<R> 155 174 { 175 friend class shared_future<R>; 176 156 177 public: 157 178 future() noexcept … … 175 196 shared_future<R> share() 176 197 { 177 return shared_future<R> (move(*this));198 return shared_future<R>{move(*this)}; 178 199 } 179 200 … … 194 215 class future<R&>: public aux::future_base<R*> 195 216 { 217 friend class shared_future<R&>; 218 196 219 public: 197 220 future() noexcept … … 215 238 shared_future<R&> share() 216 239 { 217 return shared_future<R&> (move(*this));240 return shared_future<R&>{move(*this)}; 218 241 } 219 242 … … 235 258 class future<void>: public aux::future_base<void> 236 259 { 260 friend class shared_future<void>; 261 237 262 public: 238 263 future() noexcept … … 254 279 future& operator=(future&& rhs) noexcept = default; 255 280 256 /* shared_future<void> share() */ 257 /* { */ 258 /* return shared_future<void>(move(*this)); */ 259 /* } */ 281 /** 282 * Note: This is just forward declaration, implementation 283 * provided in shared_future.hpp to avoid problems 284 * with incomplete types. 285 */ 286 shared_future<void> share(); 260 287 261 288 void get()
Note:
See TracChangeset
for help on using the changeset viewer.