Changeset bd6ad4b in mainline
- Timestamp:
- 2019-07-01T09:49:54Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 60cb9e1
- Parents:
- 3a29607
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/__bits/thread/future.hpp
r3a29607 rbd6ad4b 54 54 55 55 future_base(future_base&& rhs) noexcept 56 : state_{ std::move(rhs.state_)}56 : state_{move(rhs.state_)} 57 57 { 58 58 rhs.state_ = nullptr; … … 80 80 { 81 81 release_state_(); 82 state_ = std::move(rhs.state_);82 state_ = move(rhs.state_); 83 83 rhs.state_ = nullptr; 84 84 } … … 162 162 163 163 future(future&& rhs) noexcept 164 : aux::future_base<R>{ std::move(rhs.state_)}164 : aux::future_base<R>{move(rhs.state_)} 165 165 { /* DUMMY BODY */ } 166 166 … … 173 173 future& operator=(future&& rhs) noexcept 174 174 { 175 return aux::future_base<R>::operator=( std::move(rhs));175 return aux::future_base<R>::operator=(move(rhs)); 176 176 } 177 177 178 178 shared_future<R> share() 179 179 { 180 return shared_future<R>( std::move(*this));180 return shared_future<R>(move(*this)); 181 181 } 182 182 … … 190 190 this->state_->throw_stored_exception(); 191 191 192 return move(this->state_->get()); 193 } 194 }; 195 196 template<class R> 197 class future<R&>: public aux::future_base<R&> 198 { 199 public: 200 future() noexcept 201 : aux::future_base<R&>{} 202 { /* DUMMY BODY */ } 203 204 future(const future&) = delete; 205 206 future(future&& rhs) noexcept 207 : aux::future_base<R&>{move(rhs.state_)} 208 { /* DUMMY BODY */ } 209 210 future(aux::shared_state<R&>* state) 211 : aux::future_base<R&>{state} 212 { /* DUMMY BODY */ } 213 214 future& operator=(const future&) = delete; 215 216 future& operator=(future&& rhs) noexcept 217 { 218 return aux::future_base<R>::operator=(move(rhs)); 219 } 220 221 shared_future<R&> share() 222 { 223 return shared_future<R&>(move(*this)); 224 } 225 226 R& get() 227 { 228 assert(this->state_); 229 230 this->wait(); 231 232 if (this->state_->has_exception()) 233 this->state_->throw_stored_exception(); 234 192 235 return this->state_->get(); 193 236 } 194 237 }; 195 238 196 template<class R>197 class future<R&>198 {199 // TODO: Copy & modify once future is done.200 };201 202 239 template<> 203 class future<void> 204 { 205 // TODO: Copy & modify once future is done. 240 class future<void>: public aux::future_base<void> 241 { 242 public: 243 future() noexcept 244 : aux::future_base<void>{} 245 { /* DUMMY BODY */ } 246 247 future(const future&) = delete; 248 249 future(future&& rhs) noexcept 250 : aux::future_base<void>{move(rhs.state_)} 251 { /* DUMMY BODY */ } 252 253 future(aux::shared_state<void>* state) 254 : aux::future_base<void>{state} 255 { /* DUMMY BODY */ } 256 257 future& operator=(const future&) = delete; 258 259 future& operator=(future&& rhs) noexcept = default; 260 261 /* shared_future<void> share() */ 262 /* { */ 263 /* return shared_future<void>(move(*this)); */ 264 /* } */ 265 266 void get() 267 { 268 assert(this->state_); 269 270 this->wait(); 271 272 if (this->state_->has_exception()) 273 this->state_->throw_stored_exception(); 274 } 206 275 }; 207 276 }
Note:
See TracChangeset
for help on using the changeset viewer.