MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / basic_future

Class basic_future

extern/boost/boost/thread/future.hpp:1330–1522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1328 /// Common implementation for future and shared_future.
1329 template <typename R>
1330 class basic_future : public base_future
1331 {
1332 protected:
1333 public:
1334
1335 typedef boost::shared_ptr<detail::shared_state<R> > future_ptr;
1336 typedef typename detail::shared_state<R>::move_dest_type move_dest_type;
1337
1338 static //BOOST_CONSTEXPR
1339 future_ptr make_exceptional_future_ptr(exceptional_ptr const& ex) {
1340 return future_ptr(new detail::shared_state<R>(ex));
1341 }
1342
1343 future_ptr future_;
1344
1345 basic_future(future_ptr a_future):
1346 future_(a_future)
1347 {
1348 }
1349
1350 public:
1351 typedef future_state::state state;
1352
1353 BOOST_THREAD_MOVABLE_ONLY(basic_future)
1354 basic_future(): future_() {}
1355
1356
1357 //BOOST_CONSTEXPR
1358 basic_future(exceptional_ptr const& ex)
1359 : future_(make_exceptional_future_ptr(ex))
1360 {
1361 }
1362
1363 ~basic_future() {
1364 }
1365
1366 basic_future(BOOST_THREAD_RV_REF(basic_future) other) BOOST_NOEXCEPT:
1367 future_(BOOST_THREAD_RV(other).future_)
1368 {
1369 BOOST_THREAD_RV(other).future_.reset();
1370 }
1371 basic_future& operator=(BOOST_THREAD_RV_REF(basic_future) other) BOOST_NOEXCEPT
1372 {
1373 future_=BOOST_THREAD_RV(other).future_;
1374 BOOST_THREAD_RV(other).future_.reset();
1375 return *this;
1376 }
1377 void swap(basic_future& that) BOOST_NOEXCEPT
1378 {
1379 future_.swap(that.future_);
1380 }
1381 // functions to check state, and wait for ready
1382 state get_state(boost::unique_lock<boost::mutex>& lk) const
1383 {
1384 if(!future_)
1385 {
1386 return future_state::uninitialized;
1387 }

Callers

nothing calls this directly

Calls 4

validMethod · 0.80
throw_exceptionFunction · 0.50
resetMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected