mirror of
https://github.com/boostorg/thread.git
synced 2026-02-09 11:32:12 +00:00
Compare commits
8 Commits
svn-branch
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffc1bbcbb2 | ||
|
|
398b6a83a7 | ||
|
|
b576a57581 | ||
|
|
5ad66c7e35 | ||
|
|
d0817640b6 | ||
|
|
11e6fd20bf | ||
|
|
e722202ee6 | ||
|
|
2b9e87cc2f |
@@ -26,20 +26,6 @@
|
||||
#define BOOST_THREAD_USES_CHRONO
|
||||
#endif
|
||||
|
||||
//#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
|
||||
//#define BOOST_THREAD_DONT_USE_MOVE
|
||||
//#endif
|
||||
|
||||
//#define BOOST_THREAD_SHARED_MUTEX_PROVIDES_UPWARDS_CONVERSION
|
||||
//#define BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION explicit
|
||||
#else
|
||||
#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION
|
||||
#endif
|
||||
|
||||
|
||||
#if ! defined BOOST_THREAD_DONT_USE_MOVE
|
||||
#define BOOST_THREAD_USES_MOVE
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace boost
|
||||
class BOOST_THREAD_DECL thread
|
||||
{
|
||||
public:
|
||||
//typedef int boost_move_emulation_t;
|
||||
typedef int boost_move_emulation_t;
|
||||
typedef thread_attributes attributes;
|
||||
|
||||
#ifndef BOOST_NO_DELETED_FUNCTIONS
|
||||
@@ -153,8 +153,20 @@ namespace boost
|
||||
thread& operator=(thread const&) = delete;
|
||||
#else // BOOST_NO_DELETED_FUNCTIONS
|
||||
private:
|
||||
// BOOST_MOVABLE_BUT_NOT_COPYABLE(thread)
|
||||
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
private:
|
||||
//thread(thread const&);
|
||||
thread(thread &);
|
||||
//thread& operator=(thread const&);
|
||||
thread& operator=(thread &);
|
||||
#else
|
||||
private:
|
||||
thread(thread&);
|
||||
thread& operator=(thread&);
|
||||
#endif
|
||||
public:
|
||||
#endif // BOOST_NO_DELETED_FUNCTIONS
|
||||
private:
|
||||
|
||||
@@ -388,15 +400,6 @@ namespace boost
|
||||
#endif
|
||||
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
::boost::rv<thread>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<thread>* >(this);
|
||||
}
|
||||
const ::boost::rv<thread>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<thread>* >(this);
|
||||
}
|
||||
|
||||
operator ::boost::rv<thread>&()
|
||||
{
|
||||
return *static_cast< ::boost::rv<thread>* >(this);
|
||||
|
||||
@@ -789,8 +789,8 @@ namespace boost
|
||||
|
||||
#ifndef BOOST_NO_DELETED_FUNCTIONS
|
||||
public:
|
||||
BOOST_THREAD_FUTURE(BOOST_THREAD_FUTURE const& rhs) = delete;
|
||||
BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_FUTURE const& rhs) = delete;
|
||||
BOOST_THREAD_FUTURE(BOOST_THREAD_FUTURE & rhs) = delete;
|
||||
BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_FUTURE& rhs) = delete;
|
||||
#else // BOOST_NO_DELETED_FUNCTIONS
|
||||
private:
|
||||
BOOST_THREAD_FUTURE(BOOST_THREAD_FUTURE & rhs);// = delete;
|
||||
@@ -824,11 +824,11 @@ namespace boost
|
||||
{}
|
||||
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
BOOST_THREAD_FUTURE(BOOST_THREAD_FUTURE && other) BOOST_NOEXCEPT
|
||||
BOOST_THREAD_FUTURE(BOOST_THREAD_FUTURE && other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
}
|
||||
BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_FUTURE && other) BOOST_NOEXCEPT
|
||||
BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_FUTURE && other)
|
||||
{
|
||||
future_=other.future_;
|
||||
other.future_.reset();
|
||||
@@ -836,13 +836,13 @@ namespace boost
|
||||
}
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
BOOST_THREAD_FUTURE(boost::rv<BOOST_THREAD_FUTURE>& other) BOOST_NOEXCEPT:
|
||||
BOOST_THREAD_FUTURE(boost::rv<BOOST_THREAD_FUTURE>& other):
|
||||
future_(other.future_)
|
||||
{
|
||||
other.future_.reset();
|
||||
}
|
||||
|
||||
BOOST_THREAD_FUTURE& operator=(boost::rv<BOOST_THREAD_FUTURE>& other) BOOST_NOEXCEPT
|
||||
BOOST_THREAD_FUTURE& operator=(boost::rv<BOOST_THREAD_FUTURE>& other)
|
||||
{
|
||||
future_=other.future_;
|
||||
other.future_.reset();
|
||||
@@ -856,22 +856,14 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<BOOST_THREAD_FUTURE>* >(this);
|
||||
}
|
||||
::boost::rv<BOOST_THREAD_FUTURE>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<BOOST_THREAD_FUTURE>* >(this);
|
||||
}
|
||||
const ::boost::rv<BOOST_THREAD_FUTURE>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<BOOST_THREAD_FUTURE>* >(this);
|
||||
}
|
||||
#else
|
||||
BOOST_THREAD_FUTURE(boost::detail::thread_move_t<BOOST_THREAD_FUTURE> other) BOOST_NOEXCEPT:
|
||||
BOOST_THREAD_FUTURE(boost::detail::thread_move_t<BOOST_THREAD_FUTURE> other):
|
||||
future_(other->future_)
|
||||
{
|
||||
other->future_.reset();
|
||||
}
|
||||
|
||||
BOOST_THREAD_FUTURE& operator=(boost::detail::thread_move_t<BOOST_THREAD_FUTURE> other) BOOST_NOEXCEPT
|
||||
BOOST_THREAD_FUTURE& operator=(boost::detail::thread_move_t<BOOST_THREAD_FUTURE> other)
|
||||
{
|
||||
future_=other->future_;
|
||||
other->future_.reset();
|
||||
@@ -882,16 +874,8 @@ namespace boost
|
||||
{
|
||||
return boost::detail::thread_move_t<BOOST_THREAD_FUTURE>(*this);
|
||||
}
|
||||
boost::detail::thread_move_t<BOOST_THREAD_FUTURE> move()
|
||||
{
|
||||
return boost::detail::thread_move_t<BOOST_THREAD_FUTURE>(*this);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
shared_future<R> share()
|
||||
{
|
||||
return shared_future<R>(::boost::move(*this));
|
||||
}
|
||||
|
||||
void swap(BOOST_THREAD_FUTURE& other)
|
||||
{
|
||||
@@ -910,7 +894,7 @@ namespace boost
|
||||
}
|
||||
|
||||
// functions to check state, and wait for ready
|
||||
state get_state() const BOOST_NOEXCEPT
|
||||
state get_state() const
|
||||
{
|
||||
if(!future_)
|
||||
{
|
||||
@@ -920,22 +904,22 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
bool is_ready() const BOOST_NOEXCEPT
|
||||
bool is_ready() const
|
||||
{
|
||||
return get_state()==future_state::ready;
|
||||
}
|
||||
|
||||
bool has_exception() const BOOST_NOEXCEPT
|
||||
bool has_exception() const
|
||||
{
|
||||
return future_ && future_->has_exception();
|
||||
}
|
||||
|
||||
bool has_value() const BOOST_NOEXCEPT
|
||||
bool has_value() const
|
||||
{
|
||||
return future_ && future_->has_value();
|
||||
}
|
||||
|
||||
bool valid() const BOOST_NOEXCEPT
|
||||
bool valid() const
|
||||
{
|
||||
return future_ != 0;
|
||||
}
|
||||
@@ -1029,21 +1013,21 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
shared_future(shared_future && other) BOOST_NOEXCEPT
|
||||
shared_future(shared_future && other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
}
|
||||
shared_future(BOOST_THREAD_FUTURE<R> && other) BOOST_NOEXCEPT
|
||||
shared_future(BOOST_THREAD_FUTURE<R> && other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
}
|
||||
shared_future& operator=(shared_future && other) BOOST_NOEXCEPT
|
||||
shared_future& operator=(shared_future && other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
other.future_.reset();
|
||||
return *this;
|
||||
}
|
||||
shared_future& operator=(BOOST_THREAD_FUTURE<R> && other) BOOST_NOEXCEPT
|
||||
shared_future& operator=(BOOST_THREAD_FUTURE<R> && other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
other.future_.reset();
|
||||
@@ -1051,24 +1035,24 @@ namespace boost
|
||||
}
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
shared_future(boost::rv<shared_future>& other) BOOST_NOEXCEPT :
|
||||
shared_future(boost::rv<shared_future>& other):
|
||||
future_(other.future_)
|
||||
{
|
||||
other.future_.reset();
|
||||
}
|
||||
// shared_future(const BOOST_THREAD_FUTURE<R> &) = delete;
|
||||
shared_future(boost::rv<BOOST_THREAD_FUTURE<R> >& other) BOOST_NOEXCEPT :
|
||||
shared_future(boost::rv<BOOST_THREAD_FUTURE<R> >& other):
|
||||
future_(other.future_)
|
||||
{
|
||||
other.future_.reset();
|
||||
}
|
||||
shared_future& operator=(boost::rv<shared_future>& other) BOOST_NOEXCEPT
|
||||
shared_future& operator=(boost::rv<shared_future>& other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
other.future_.reset();
|
||||
return *this;
|
||||
}
|
||||
shared_future& operator=(boost::rv<BOOST_THREAD_FUTURE<R> >& other) BOOST_NOEXCEPT
|
||||
shared_future& operator=(boost::rv<BOOST_THREAD_FUTURE<R> >& other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
other.future_.reset();
|
||||
@@ -1082,35 +1066,27 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<shared_future>* >(this);
|
||||
}
|
||||
::boost::rv<shared_future>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<shared_future>* >(this);
|
||||
}
|
||||
const ::boost::rv<shared_future>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<shared_future>* >(this);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
shared_future(boost::detail::thread_move_t<shared_future> other) BOOST_NOEXCEPT :
|
||||
shared_future(boost::detail::thread_move_t<shared_future> other):
|
||||
future_(other->future_)
|
||||
{
|
||||
other->future_.reset();
|
||||
}
|
||||
// shared_future(const BOOST_THREAD_FUTURE<R> &) = delete;
|
||||
shared_future(boost::detail::thread_move_t<BOOST_THREAD_FUTURE<R> > other) BOOST_NOEXCEPT :
|
||||
shared_future(boost::detail::thread_move_t<BOOST_THREAD_FUTURE<R> > other):
|
||||
future_(other->future_)
|
||||
{
|
||||
other->future_.reset();
|
||||
}
|
||||
shared_future& operator=(boost::detail::thread_move_t<shared_future> other) BOOST_NOEXCEPT
|
||||
shared_future& operator=(boost::detail::thread_move_t<shared_future> other)
|
||||
{
|
||||
future_.swap(other->future_);
|
||||
other->future_.reset();
|
||||
return *this;
|
||||
}
|
||||
shared_future& operator=(boost::detail::thread_move_t<BOOST_THREAD_FUTURE<R> > other) BOOST_NOEXCEPT
|
||||
shared_future& operator=(boost::detail::thread_move_t<BOOST_THREAD_FUTURE<R> > other)
|
||||
{
|
||||
future_.swap(other->future_);
|
||||
other->future_.reset();
|
||||
@@ -1121,14 +1097,10 @@ namespace boost
|
||||
{
|
||||
return boost::detail::thread_move_t<shared_future>(*this);
|
||||
}
|
||||
boost::detail::thread_move_t<shared_future> move()
|
||||
{
|
||||
return boost::detail::thread_move_t<shared_future>(*this);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void swap(shared_future& other) BOOST_NOEXCEPT
|
||||
void swap(shared_future& other)
|
||||
{
|
||||
future_.swap(other.future_);
|
||||
}
|
||||
@@ -1145,7 +1117,7 @@ namespace boost
|
||||
}
|
||||
|
||||
// functions to check state, and wait for ready
|
||||
state get_state() const BOOST_NOEXCEPT
|
||||
state get_state() const
|
||||
{
|
||||
if(!future_)
|
||||
{
|
||||
@@ -1154,22 +1126,18 @@ namespace boost
|
||||
return future_->get_state();
|
||||
}
|
||||
|
||||
bool valid() const BOOST_NOEXCEPT
|
||||
{
|
||||
return future_ != 0;
|
||||
}
|
||||
|
||||
bool is_ready() const BOOST_NOEXCEPT
|
||||
bool is_ready() const
|
||||
{
|
||||
return get_state()==future_state::ready;
|
||||
}
|
||||
|
||||
bool has_exception() const BOOST_NOEXCEPT
|
||||
bool has_exception() const
|
||||
{
|
||||
return future_ && future_->has_exception();
|
||||
}
|
||||
|
||||
bool has_value() const BOOST_NOEXCEPT
|
||||
bool has_value() const
|
||||
{
|
||||
return future_ && future_->has_value();
|
||||
}
|
||||
@@ -1236,8 +1204,8 @@ namespace boost
|
||||
|
||||
#ifndef BOOST_NO_DELETED_FUNCTIONS
|
||||
public:
|
||||
promise(promise const& rhs) = delete;
|
||||
promise & operator=(promise const & rhs) = delete;
|
||||
promise(promise const& rhs);// = delete;
|
||||
promise & operator=(promise const & rhs);// = delete;
|
||||
#else // BOOST_NO_DELETED_FUNCTIONS
|
||||
private:
|
||||
promise(promise & rhs);// = delete;
|
||||
@@ -1283,21 +1251,21 @@ namespace boost
|
||||
|
||||
// Assignment
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
promise(promise && rhs) BOOST_NOEXCEPT:
|
||||
//#if ! BOOST_THREAD_VERSION==1
|
||||
// future_(rhs.future_),
|
||||
//#endif
|
||||
promise(promise && rhs):
|
||||
#if ! BOOST_THREAD_VERSION==1
|
||||
future_(rhs.future_),
|
||||
#endif
|
||||
future_obtained(rhs.future_obtained)
|
||||
{
|
||||
//#if BOOST_THREAD_VERSION==1
|
||||
future_.swap(rhs.future_);
|
||||
//#else
|
||||
// we need to release the future as shared_ptr doesn't implements move semantics
|
||||
#if BOOST_THREAD_VERSION==1
|
||||
future_.swap(rhs.future_);
|
||||
#else
|
||||
// we need to release the future as shared_ptr doesn't implements move semantics
|
||||
rhs.future_.reset();
|
||||
//#endif
|
||||
#endif
|
||||
rhs.future_obtained=false;
|
||||
}
|
||||
promise & operator=(promise&& rhs) BOOST_NOEXCEPT
|
||||
promise & operator=(promise&& rhs)
|
||||
{
|
||||
#if BOOST_THREAD_VERSION==1
|
||||
future_.swap(rhs.future_);
|
||||
@@ -1312,13 +1280,13 @@ namespace boost
|
||||
}
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
promise(boost::rv<promise>& rhs) BOOST_NOEXCEPT :
|
||||
promise(boost::rv<promise>& rhs):
|
||||
future_(rhs.future_),future_obtained(rhs.future_obtained)
|
||||
{
|
||||
rhs.future_.reset();
|
||||
rhs.future_obtained=false;
|
||||
}
|
||||
promise & operator=(boost::rv<promise>& rhs) BOOST_NOEXCEPT
|
||||
promise & operator=(boost::rv<promise>& rhs)
|
||||
{
|
||||
future_=rhs.future_;
|
||||
future_obtained=rhs.future_obtained;
|
||||
@@ -1334,22 +1302,14 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<promise>* >(this);
|
||||
}
|
||||
::boost::rv<promise>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<promise>* >(this);
|
||||
}
|
||||
const ::boost::rv<promise>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<promise>* >(this);
|
||||
}
|
||||
#else
|
||||
promise(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT:
|
||||
promise(boost::detail::thread_move_t<promise> rhs):
|
||||
future_(rhs->future_),future_obtained(rhs->future_obtained)
|
||||
{
|
||||
rhs->future_.reset();
|
||||
rhs->future_obtained=false;
|
||||
}
|
||||
promise & operator=(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT
|
||||
promise & operator=(boost::detail::thread_move_t<promise> rhs)
|
||||
{
|
||||
future_=rhs->future_;
|
||||
future_obtained=rhs->future_obtained;
|
||||
@@ -1440,8 +1400,8 @@ namespace boost
|
||||
|
||||
#ifndef BOOST_NO_DELETED_FUNCTIONS
|
||||
public:
|
||||
promise(promise const& rhs) = delete;
|
||||
promise & operator=(promise const & rhs) = delete;
|
||||
promise(promise const& rhs);// = delete;
|
||||
promise & operator=(promise const & rhs);// = delete;
|
||||
#else // BOOST_NO_DELETED_FUNCTIONS
|
||||
private:
|
||||
promise(promise & rhs);// = delete;
|
||||
@@ -1451,24 +1411,17 @@ namespace boost
|
||||
|
||||
void lazy_init()
|
||||
{
|
||||
#if BOOST_THREAD_VERSION==1
|
||||
if(!atomic_load(&future_))
|
||||
{
|
||||
future_ptr blank;
|
||||
atomic_compare_exchange(&future_,&blank,future_ptr(new detail::future_object<void>));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
// template <class Allocator> explicit promise(Allocator a);
|
||||
|
||||
promise():
|
||||
#if BOOST_THREAD_VERSION==1
|
||||
future_(),
|
||||
#else
|
||||
future_(new detail::future_object<void>),
|
||||
#endif
|
||||
future_obtained(false)
|
||||
future_(),future_obtained(false)
|
||||
{}
|
||||
|
||||
~promise()
|
||||
@@ -1486,15 +1439,13 @@ namespace boost
|
||||
|
||||
// Assignment
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
promise(promise && rhs) BOOST_NOEXCEPT :
|
||||
promise(promise && rhs):
|
||||
future_obtained(rhs.future_obtained)
|
||||
{
|
||||
future_.swap(rhs.future_);
|
||||
// we need to release the future as shared_ptr doesn't implements move semantics
|
||||
rhs.future_.reset();
|
||||
rhs.future_obtained=false;
|
||||
}
|
||||
promise & operator=(promise&& rhs) BOOST_NOEXCEPT
|
||||
promise & operator=(promise&& rhs)
|
||||
{
|
||||
future_.swap(rhs.future_);
|
||||
future_obtained=rhs.future_obtained;
|
||||
@@ -1504,13 +1455,13 @@ namespace boost
|
||||
}
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
promise(boost::rv<promise>& rhs) BOOST_NOEXCEPT :
|
||||
promise(boost::rv<promise>& rhs):
|
||||
future_(rhs.future_),future_obtained(rhs.future_obtained)
|
||||
{
|
||||
rhs.future_.reset();
|
||||
rhs.future_obtained=false;
|
||||
}
|
||||
promise & operator=(boost::rv<promise>& rhs) BOOST_NOEXCEPT
|
||||
promise & operator=(boost::rv<promise>& rhs)
|
||||
{
|
||||
future_=rhs.future_;
|
||||
future_obtained=rhs.future_obtained;
|
||||
@@ -1526,22 +1477,14 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<promise>* >(this);
|
||||
}
|
||||
::boost::rv<promise>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<promise>* >(this);
|
||||
}
|
||||
const ::boost::rv<promise>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<promise>* >(this);
|
||||
}
|
||||
#else
|
||||
promise(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT :
|
||||
promise(boost::detail::thread_move_t<promise> rhs):
|
||||
future_(rhs->future_),future_obtained(rhs->future_obtained)
|
||||
{
|
||||
rhs->future_.reset();
|
||||
rhs->future_obtained=false;
|
||||
}
|
||||
promise & operator=(boost::detail::thread_move_t<promise> rhs) BOOST_NOEXCEPT
|
||||
promise & operator=(boost::detail::thread_move_t<promise> rhs)
|
||||
{
|
||||
future_=rhs->future_;
|
||||
future_obtained=rhs->future_obtained;
|
||||
@@ -1554,10 +1497,6 @@ namespace boost
|
||||
{
|
||||
return boost::detail::thread_move_t<promise>(*this);
|
||||
}
|
||||
boost::detail::thread_move_t<promise> move()
|
||||
{
|
||||
return boost::detail::thread_move_t<promise>(*this);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1572,10 +1511,6 @@ namespace boost
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
if (future_.get()==0)
|
||||
{
|
||||
boost::throw_exception(promise_moved());
|
||||
}
|
||||
if(future_obtained)
|
||||
{
|
||||
boost::throw_exception(future_already_retrieved());
|
||||
@@ -1756,8 +1691,8 @@ namespace boost
|
||||
|
||||
#ifndef BOOST_NO_DELETED_FUNCTIONS
|
||||
public:
|
||||
packaged_task(packaged_task const&) = delete;
|
||||
packaged_task& operator=(packaged_task const&) = delete;
|
||||
packaged_task(packaged_task const&);// = delete;
|
||||
packaged_task& operator=(packaged_task const&);// = delete;
|
||||
#else // BOOST_NO_DELETED_FUNCTIONS
|
||||
private:
|
||||
packaged_task(packaged_task&);// = delete;
|
||||
@@ -1812,13 +1747,13 @@ namespace boost
|
||||
|
||||
// assignment
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
packaged_task(packaged_task&& other) BOOST_NOEXCEPT :
|
||||
packaged_task(packaged_task&& other):
|
||||
future_obtained(other.future_obtained)
|
||||
{
|
||||
task.swap(other.task);
|
||||
other.future_obtained=false;
|
||||
}
|
||||
packaged_task& operator=(packaged_task&& other) BOOST_NOEXCEPT
|
||||
packaged_task& operator=(packaged_task&& other)
|
||||
{
|
||||
packaged_task temp(static_cast<packaged_task&&>(other));
|
||||
swap(temp);
|
||||
@@ -1826,13 +1761,13 @@ namespace boost
|
||||
}
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
packaged_task(boost::rv<packaged_task>& other) BOOST_NOEXCEPT :
|
||||
packaged_task(boost::rv<packaged_task>& other):
|
||||
future_obtained(other.future_obtained)
|
||||
{
|
||||
task.swap(other.task);
|
||||
other.future_obtained=false;
|
||||
}
|
||||
packaged_task& operator=(boost::rv<packaged_task>& other) BOOST_NOEXCEPT
|
||||
packaged_task& operator=(boost::rv<packaged_task>& other)
|
||||
{
|
||||
packaged_task temp(other);
|
||||
swap(temp);
|
||||
@@ -1846,22 +1781,14 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<packaged_task>* >(this);
|
||||
}
|
||||
::boost::rv<packaged_task>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<packaged_task>* >(this);
|
||||
}
|
||||
const ::boost::rv<packaged_task>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<packaged_task>* >(this);
|
||||
}
|
||||
#else
|
||||
packaged_task(boost::detail::thread_move_t<packaged_task> other) BOOST_NOEXCEPT:
|
||||
packaged_task(boost::detail::thread_move_t<packaged_task> other):
|
||||
future_obtained(other->future_obtained)
|
||||
{
|
||||
task.swap(other->task);
|
||||
other->future_obtained=false;
|
||||
}
|
||||
packaged_task& operator=(boost::detail::thread_move_t<packaged_task> other) BOOST_NOEXCEPT
|
||||
packaged_task& operator=(boost::detail::thread_move_t<packaged_task> other)
|
||||
{
|
||||
packaged_task temp(other);
|
||||
swap(temp);
|
||||
@@ -1871,22 +1798,14 @@ namespace boost
|
||||
{
|
||||
return boost::detail::thread_move_t<packaged_task>(*this);
|
||||
}
|
||||
boost::detail::thread_move_t<packaged_task> move()
|
||||
{
|
||||
return boost::detail::thread_move_t<packaged_task>(*this);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void swap(packaged_task& other) BOOST_NOEXCEPT
|
||||
void swap(packaged_task& other)
|
||||
{
|
||||
task.swap(other.task);
|
||||
std::swap(future_obtained,other.future_obtained);
|
||||
}
|
||||
bool valid() const BOOST_NOEXCEPT
|
||||
{
|
||||
return task.get()!=0;
|
||||
}
|
||||
|
||||
// result retrieval
|
||||
BOOST_THREAD_FUTURE<R> get_future()
|
||||
|
||||
@@ -278,6 +278,7 @@ namespace boost
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename Mutex>
|
||||
class unique_lock
|
||||
{
|
||||
@@ -355,24 +356,22 @@ namespace boost
|
||||
other.is_locked=false;
|
||||
other.m=0;
|
||||
}
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(upgrade_lock<Mutex>&& other);
|
||||
explicit unique_lock(upgrade_lock<Mutex>&& other);
|
||||
|
||||
|
||||
unique_lock& operator=(unique_lock&& other) BOOST_NOEXCEPT
|
||||
{
|
||||
unique_lock temp(::boost::move(other));
|
||||
unique_lock temp(move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
unique_lock& operator=(upgrade_lock<Mutex>&& other) BOOST_NOEXCEPT
|
||||
{
|
||||
unique_lock temp(::boost::move(other));
|
||||
unique_lock temp(move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
unique_lock(boost::rv<unique_lock<Mutex> >& other) BOOST_NOEXCEPT:
|
||||
@@ -381,7 +380,7 @@ namespace boost
|
||||
other.is_locked=false;
|
||||
other.m=0;
|
||||
}
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(boost::rv<upgrade_lock<Mutex> >& other);
|
||||
unique_lock(boost::rv<upgrade_lock<Mutex> >& other);
|
||||
|
||||
operator ::boost::rv<unique_lock<Mutex> >&()
|
||||
{
|
||||
@@ -391,14 +390,7 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<unique_lock<Mutex> >* >(this);
|
||||
}
|
||||
::boost::rv<unique_lock<Mutex> >& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<unique_lock<Mutex> >* >(this);
|
||||
}
|
||||
const ::boost::rv<unique_lock<Mutex> >& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<unique_lock<Mutex> >* >(this);
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
|
||||
unique_lock& operator=(unique_lock<Mutex> other)
|
||||
{
|
||||
@@ -414,14 +406,12 @@ namespace boost
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
unique_lock& operator=(boost::rv<upgrade_lock<Mutex> >& other) BOOST_NOEXCEPT
|
||||
{
|
||||
unique_lock temp(other);
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
unique_lock(detail::thread_move_t<unique_lock<Mutex> > other) BOOST_NOEXCEPT:
|
||||
m(other->m),is_locked(other->is_locked)
|
||||
@@ -429,7 +419,7 @@ namespace boost
|
||||
other->is_locked=false;
|
||||
other->m=0;
|
||||
}
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(detail::thread_move_t<upgrade_lock<Mutex> > other);
|
||||
unique_lock(detail::thread_move_t<upgrade_lock<Mutex> > other);
|
||||
|
||||
operator detail::thread_move_t<unique_lock<Mutex> >()
|
||||
{
|
||||
@@ -456,15 +446,12 @@ namespace boost
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
unique_lock& operator=(detail::thread_move_t<upgrade_lock<Mutex> > other) BOOST_NOEXCEPT
|
||||
{
|
||||
unique_lock temp(other);
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
void swap(detail::thread_move_t<unique_lock<Mutex> > other) BOOST_NOEXCEPT
|
||||
{
|
||||
std::swap(m,other->m);
|
||||
@@ -472,174 +459,6 @@ namespace boost
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
// Conversion from upgrade locking
|
||||
unique_lock(upgrade_lock<mutex_type>&& ul, try_to_lock_t)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock())
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
template <class Clock, class Duration>
|
||||
unique_lock(upgrade_lock<mutex_type>&& ul,
|
||||
const chrono::time_point<Clock, Duration>& abs_time)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock_until(abs_time))
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
|
||||
template <class Rep, class Period>
|
||||
unique_lock(upgrade_lock<mutex_type>&& ul,
|
||||
const chrono::duration<Rep, Period>& rel_time)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock_for(rel_time))
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
// Conversion from upgrade locking
|
||||
unique_lock(boost::rv<upgrade_lock<mutex_type> > &ul, try_to_lock_t)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock())
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
template <class Clock, class Duration>
|
||||
unique_lock(boost::rv<upgrade_lock<mutex_type> > &ul,
|
||||
const chrono::time_point<Clock, Duration>& abs_time)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock_until(abs_time))
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
|
||||
template <class Rep, class Period>
|
||||
unique_lock(boost::rv<upgrade_lock<mutex_type> > &ul,
|
||||
const chrono::duration<Rep, Period>& rel_time)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock_for(rel_time))
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
// Conversion from upgrade locking
|
||||
unique_lock(detail::thread_move_t<upgrade_lock<mutex_type> > ul, try_to_lock_t)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock())
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
template <class Clock, class Duration>
|
||||
unique_lock(detail::thread_move_t<upgrade_lock<mutex_type> > ul,
|
||||
const chrono::time_point<Clock, Duration>& abs_time)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock_until(abs_time))
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
|
||||
template <class Rep, class Period>
|
||||
unique_lock(detail::thread_move_t<upgrade_lock<mutex_type> > ul,
|
||||
const chrono::duration<Rep, Period>& rel_time)
|
||||
: m(0),is_locked(false)
|
||||
{
|
||||
if (ul.owns_lock()) {
|
||||
if (ul.mutex()->try_unlock_upgrade_and_lock_for(rel_time))
|
||||
{
|
||||
m = ul.release();
|
||||
is_locked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m = ul.release();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void swap(unique_lock& other) BOOST_NOEXCEPT
|
||||
{
|
||||
std::swap(m,other.m);
|
||||
@@ -883,7 +702,7 @@ namespace boost
|
||||
other.m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(unique_lock<Mutex> && other):
|
||||
shared_lock(unique_lock<Mutex> && other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -894,7 +713,7 @@ namespace boost
|
||||
other.m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(upgrade_lock<Mutex> && other):
|
||||
shared_lock(upgrade_lock<Mutex> && other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -908,26 +727,25 @@ namespace boost
|
||||
|
||||
shared_lock& operator=(shared_lock<Mutex> && other)
|
||||
{
|
||||
shared_lock temp(::boost::move(other));
|
||||
shared_lock temp(boost::move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
shared_lock& operator=(unique_lock<Mutex> && other)
|
||||
{
|
||||
shared_lock temp(::boost::move(other));
|
||||
shared_lock temp(boost::move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
shared_lock& operator=(upgrade_lock<Mutex> && other)
|
||||
{
|
||||
shared_lock temp(::boost::move(other));
|
||||
shared_lock temp(boost::move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
shared_lock(boost::rv<shared_lock<Mutex> >& other):
|
||||
@@ -937,7 +755,7 @@ namespace boost
|
||||
other.m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(boost::rv<unique_lock<Mutex> >& other):
|
||||
shared_lock(boost::rv<unique_lock<Mutex> >& other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -948,7 +766,7 @@ namespace boost
|
||||
other.m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(boost::rv<upgrade_lock<Mutex> >& other):
|
||||
shared_lock(boost::rv<upgrade_lock<Mutex> >& other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -967,14 +785,6 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<shared_lock<Mutex> >* >(this);
|
||||
}
|
||||
::boost::rv<shared_lock<Mutex> >& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<shared_lock<Mutex> >* >(this);
|
||||
}
|
||||
const ::boost::rv<shared_lock<Mutex> >& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<shared_lock<Mutex> >* >(this);
|
||||
}
|
||||
|
||||
shared_lock& operator=(::boost::rv<shared_lock<Mutex> >& other)
|
||||
{
|
||||
@@ -983,7 +793,6 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
shared_lock& operator=(::boost::rv<unique_lock<Mutex> >& other)
|
||||
{
|
||||
shared_lock temp(other);
|
||||
@@ -997,7 +806,7 @@ namespace boost
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
shared_lock(detail::thread_move_t<shared_lock<Mutex> > other):
|
||||
@@ -1007,7 +816,7 @@ namespace boost
|
||||
other->m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(detail::thread_move_t<unique_lock<Mutex> > other):
|
||||
shared_lock(detail::thread_move_t<unique_lock<Mutex> > other):
|
||||
m(other->m),is_locked(other->is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -1018,7 +827,7 @@ namespace boost
|
||||
other->m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(detail::thread_move_t<upgrade_lock<Mutex> > other):
|
||||
shared_lock(detail::thread_move_t<upgrade_lock<Mutex> > other):
|
||||
m(other->m),is_locked(other->is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -1047,7 +856,6 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
shared_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other)
|
||||
{
|
||||
shared_lock temp(other);
|
||||
@@ -1062,7 +870,6 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void swap(shared_lock& other)
|
||||
@@ -1218,6 +1025,7 @@ namespace boost
|
||||
{};
|
||||
#endif
|
||||
|
||||
|
||||
template<typename Mutex>
|
||||
void swap(shared_lock<Mutex>& lhs,shared_lock<Mutex>& rhs)
|
||||
{
|
||||
@@ -1283,7 +1091,7 @@ namespace boost
|
||||
other.m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(unique_lock<Mutex>&& other):
|
||||
upgrade_lock(unique_lock<Mutex>&& other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -1296,19 +1104,18 @@ namespace boost
|
||||
|
||||
upgrade_lock& operator=(upgrade_lock<Mutex>&& other)
|
||||
{
|
||||
upgrade_lock temp(::boost::move(other));
|
||||
upgrade_lock temp(boost::move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
upgrade_lock& operator=(unique_lock<Mutex>&& other)
|
||||
{
|
||||
upgrade_lock temp(::boost::move(other));
|
||||
upgrade_lock temp(boost::move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
upgrade_lock(boost::rv<upgrade_lock<Mutex> >& other):
|
||||
@@ -1318,7 +1125,7 @@ namespace boost
|
||||
other.m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(boost::rv<unique_lock<Mutex> >& other):
|
||||
upgrade_lock(boost::rv<unique_lock<Mutex> >& other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -1337,14 +1144,7 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<upgrade_lock>* >(this);
|
||||
}
|
||||
::boost::rv<upgrade_lock>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<upgrade_lock>* >(this);
|
||||
}
|
||||
const ::boost::rv<upgrade_lock>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<upgrade_lock>* >(this);
|
||||
}
|
||||
|
||||
upgrade_lock& operator=(boost::rv<upgrade_lock<Mutex> >& other)
|
||||
{
|
||||
upgrade_lock temp(other);
|
||||
@@ -1352,14 +1152,12 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
upgrade_lock& operator=(boost::rv<unique_lock<Mutex> >& other)
|
||||
{
|
||||
upgrade_lock temp(other);
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
upgrade_lock(detail::thread_move_t<upgrade_lock<Mutex> > other):
|
||||
m(other->m),is_locked(other->is_locked)
|
||||
@@ -1368,7 +1166,7 @@ namespace boost
|
||||
other->m=0;
|
||||
}
|
||||
|
||||
BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(detail::thread_move_t<unique_lock<Mutex> > other):
|
||||
upgrade_lock(detail::thread_move_t<unique_lock<Mutex> > other):
|
||||
m(other->m),is_locked(other->is_locked)
|
||||
{
|
||||
if(is_locked)
|
||||
@@ -1397,7 +1195,6 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
upgrade_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other)
|
||||
{
|
||||
upgrade_lock temp(other);
|
||||
@@ -1405,7 +1202,6 @@ namespace boost
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void swap(upgrade_lock& other)
|
||||
@@ -1544,11 +1340,11 @@ namespace boost
|
||||
unique_lock<Mutex>::unique_lock(upgrade_lock<Mutex>&& other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
other.is_locked=false;
|
||||
if(is_locked)
|
||||
{
|
||||
m->unlock_upgrade_and_lock();
|
||||
}
|
||||
other.release();
|
||||
}
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
@@ -1556,22 +1352,22 @@ namespace boost
|
||||
unique_lock<Mutex>::unique_lock(boost::rv<upgrade_lock<Mutex> >& other):
|
||||
m(other.m),is_locked(other.is_locked)
|
||||
{
|
||||
other.is_locked=false;
|
||||
if(is_locked)
|
||||
{
|
||||
m->unlock_upgrade_and_lock();
|
||||
}
|
||||
other.release();
|
||||
}
|
||||
#else
|
||||
template<typename Mutex>
|
||||
unique_lock<Mutex>::unique_lock(detail::thread_move_t<upgrade_lock<Mutex> > other):
|
||||
m(other->m),is_locked(other->is_locked)
|
||||
{
|
||||
other->is_locked=false;
|
||||
if(is_locked)
|
||||
{
|
||||
m->unlock_upgrade_and_lock();
|
||||
}
|
||||
other.release();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1594,19 +1390,19 @@ namespace boost
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
explicit upgrade_to_unique_lock(upgrade_lock<Mutex>& m_):
|
||||
source(&m_),exclusive(::boost::move(*source))
|
||||
source(&m_),exclusive(move(*source))
|
||||
{}
|
||||
~upgrade_to_unique_lock()
|
||||
{
|
||||
if(source)
|
||||
{
|
||||
*source=upgrade_lock<Mutex>(::boost::move(exclusive));
|
||||
*source=move(exclusive);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
upgrade_to_unique_lock(upgrade_to_unique_lock<Mutex>&& other):
|
||||
source(other.source),exclusive(::boost::move(other.exclusive))
|
||||
source(other.source),exclusive(move(other.exclusive))
|
||||
{
|
||||
other.source=0;
|
||||
}
|
||||
@@ -1620,7 +1416,7 @@ namespace boost
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
upgrade_to_unique_lock(boost::rv<upgrade_to_unique_lock<Mutex> >& other):
|
||||
source(other.source),exclusive(::boost::move(other.exclusive))
|
||||
source(other.source),exclusive(move(other.exclusive))
|
||||
{
|
||||
other.source=0;
|
||||
}
|
||||
@@ -1639,17 +1435,9 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<upgrade_to_unique_lock>* >(this);
|
||||
}
|
||||
::boost::rv<upgrade_to_unique_lock>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<upgrade_to_unique_lock>* >(this);
|
||||
}
|
||||
const ::boost::rv<upgrade_to_unique_lock>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<upgrade_to_unique_lock>* >(this);
|
||||
}
|
||||
#else
|
||||
upgrade_to_unique_lock(detail::thread_move_t<upgrade_to_unique_lock<Mutex> > other):
|
||||
source(other->source),exclusive(::boost::move(other->exclusive))
|
||||
source(other->source),exclusive(move(other->exclusive))
|
||||
{
|
||||
other->source=0;
|
||||
}
|
||||
@@ -1733,12 +1521,12 @@ namespace boost
|
||||
{}
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
try_lock_wrapper(try_lock_wrapper&& other):
|
||||
base(::boost::move(other))
|
||||
base(move(other))
|
||||
{}
|
||||
|
||||
try_lock_wrapper& operator=(try_lock_wrapper<Mutex>&& other)
|
||||
{
|
||||
try_lock_wrapper temp(::boost::move(other));
|
||||
try_lock_wrapper temp(move(other));
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
@@ -1746,7 +1534,7 @@ namespace boost
|
||||
#else
|
||||
#if defined BOOST_THREAD_USES_MOVE
|
||||
try_lock_wrapper(boost::rv<try_lock_wrapper<Mutex> >& other):
|
||||
base(::boost::move(static_cast<base&>(other)))
|
||||
base(boost::move(static_cast<base&>(other)))
|
||||
{}
|
||||
|
||||
operator ::boost::rv<try_lock_wrapper>&()
|
||||
@@ -1757,14 +1545,6 @@ namespace boost
|
||||
{
|
||||
return *static_cast<const ::boost::rv<try_lock_wrapper>* >(this);
|
||||
}
|
||||
::boost::rv<try_lock_wrapper>& move()
|
||||
{
|
||||
return *static_cast< ::boost::rv<try_lock_wrapper>* >(this);
|
||||
}
|
||||
const ::boost::rv<try_lock_wrapper>& move() const
|
||||
{
|
||||
return *static_cast<const ::boost::rv<try_lock_wrapper>* >(this);
|
||||
}
|
||||
|
||||
try_lock_wrapper& operator=(boost::rv<try_lock_wrapper<Mutex> >& other)
|
||||
{
|
||||
|
||||
@@ -377,54 +377,16 @@ namespace boost
|
||||
release_waiters();
|
||||
}
|
||||
|
||||
bool try_unlock_upgrade_and_lock()
|
||||
{
|
||||
boost::mutex::scoped_lock lk(state_change);
|
||||
if( !state.exclusive
|
||||
&& !state.exclusive_waiting_blocked
|
||||
&& state.upgrade
|
||||
&& state.shared_count==1)
|
||||
{
|
||||
state.shared_count=0;
|
||||
state.exclusive=true;
|
||||
state.upgrade=false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#if 0 // To be added
|
||||
bool try_unlock_upgrade_and_lock();
|
||||
template <class Rep, class Period>
|
||||
bool
|
||||
try_unlock_upgrade_and_lock_for(
|
||||
const chrono::duration<Rep, Period>& rel_time)
|
||||
{
|
||||
return try_unlock_upgrade_and_lock_until(
|
||||
chrono::steady_clock::now() + rel_time);
|
||||
}
|
||||
bool
|
||||
try_unlock_upgrade_and_lock_for(
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool
|
||||
try_unlock_upgrade_and_lock_until(
|
||||
const chrono::time_point<Clock, Duration>& abs_time)
|
||||
{
|
||||
boost::this_thread::disable_interruption do_not_disturb;
|
||||
boost::mutex::scoped_lock lk(state_change);
|
||||
if (state.shared_count != 1)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
cv_status status = shared_cond.wait_until(lk,abs_time);
|
||||
if (state.shared_count == 1)
|
||||
break;
|
||||
if(status == cv_status::timeout)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
state.upgrade=false;
|
||||
state.exclusive=true;
|
||||
state.exclusive_waiting_blocked=false;
|
||||
state.shared_count=0;
|
||||
return true;
|
||||
}
|
||||
bool
|
||||
try_unlock_upgrade_and_lock_until(
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
#endif
|
||||
|
||||
// Shared <-> Exclusive
|
||||
@@ -437,6 +399,18 @@ namespace boost
|
||||
release_waiters();
|
||||
}
|
||||
|
||||
#if 0 // To be added
|
||||
bool try_unlock_shared_and_lock();
|
||||
template <class Rep, class Period>
|
||||
bool
|
||||
try_unlock_shared_and_lock_for(
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool
|
||||
try_unlock_shared_and_lock_until(
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
#endif
|
||||
|
||||
// Shared <-> Upgrade
|
||||
void unlock_upgrade_and_lock_shared()
|
||||
{
|
||||
@@ -446,9 +420,19 @@ namespace boost
|
||||
release_waiters();
|
||||
}
|
||||
|
||||
#if 0 // To be added
|
||||
bool try_unlock_shared_and_lock_upgrade();
|
||||
template <class Rep, class Period>
|
||||
bool
|
||||
try_unlock_shared_and_lock_upgrade_for(
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool
|
||||
try_unlock_shared_and_lock_upgrade_until(
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef shared_mutex upgrade_mutex;
|
||||
}
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
@@ -789,28 +789,17 @@ namespace boost
|
||||
}
|
||||
release_waiters(old_state);
|
||||
}
|
||||
// bool try_unlock_upgrade_and_lock()
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//#ifdef BOOST_THREAD_USES_CHRONO
|
||||
// template <class Rep, class Period>
|
||||
// bool
|
||||
// try_unlock_upgrade_and_lock_for(
|
||||
// const chrono::duration<Rep, Period>& rel_time)
|
||||
// {
|
||||
// return try_unlock_upgrade_and_lock_until(
|
||||
// chrono::steady_clock::now() + rel_time);
|
||||
// }
|
||||
// template <class Clock, class Duration>
|
||||
// bool
|
||||
// try_unlock_upgrade_and_lock_until(
|
||||
// const chrono::time_point<Clock, Duration>& abs_time)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//#endif
|
||||
|
||||
#if 0 // To be added
|
||||
bool try_unlock_upgrade_and_lock();
|
||||
template <class Rep, class Period>
|
||||
bool
|
||||
try_unlock_upgrade_and_lock_for(
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool
|
||||
try_unlock_upgrade_and_lock_until(
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
#endif
|
||||
void unlock_and_lock_shared()
|
||||
{
|
||||
state_data old_state=state;
|
||||
@@ -835,6 +824,17 @@ namespace boost
|
||||
}
|
||||
release_waiters(old_state);
|
||||
}
|
||||
#if 0 // To be added
|
||||
bool try_unlock_shared_and_lock();
|
||||
template <class Rep, class Period>
|
||||
bool
|
||||
try_unlock_shared_and_lock_for(
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool
|
||||
try_unlock_shared_and_lock_until(
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
#endif
|
||||
void unlock_upgrade_and_lock_shared()
|
||||
{
|
||||
state_data old_state=state;
|
||||
@@ -858,10 +858,18 @@ namespace boost
|
||||
}
|
||||
release_waiters(old_state);
|
||||
}
|
||||
|
||||
#if 0 // To be added
|
||||
bool try_unlock_shared_and_lock_upgrade();
|
||||
template <class Rep, class Period>
|
||||
bool
|
||||
try_unlock_shared_and_lock_upgrade_for(
|
||||
const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
bool
|
||||
try_unlock_shared_and_lock_upgrade_until(
|
||||
const chrono::time_point<Clock, Duration>& abs_time);
|
||||
#endif
|
||||
};
|
||||
typedef shared_mutex upgrade_mutex;
|
||||
|
||||
}
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
179
test/Jamfile.v2
179
test/Jamfile.v2
@@ -80,9 +80,9 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
[ thread-run test_shared_mutex_timed_locks.cpp ]
|
||||
[ thread-run test_shared_mutex_timed_locks_chrono.cpp ]
|
||||
#uncomment the following once these works on windows
|
||||
#[ thread-run test_v2_shared_mutex.cpp ]
|
||||
#[ thread-run test_v2_shared_mutex_part_2.cpp ]
|
||||
#[ thread-run test_v2_shared_mutex_timed_locks.cpp ]
|
||||
[ thread-run test_v2_shared_mutex.cpp ]
|
||||
[ thread-run test_v2_shared_mutex_part_2.cpp ]
|
||||
[ thread-run test_v2_shared_mutex_timed_locks.cpp ]
|
||||
[ thread-run test_lock_concept.cpp ]
|
||||
[ thread-run test_generic_locks.cpp ]
|
||||
[ thread-run test_futures.cpp ]
|
||||
@@ -122,40 +122,34 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
#explicit conditions ;
|
||||
test-suite conditions
|
||||
:
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable/assign_fail.cpp : : condition_variable__assign_f ]
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable/copy_fail.cpp : : condition_variable__copy_f ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/default_pass.cpp : condition_variable__default_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/dtor_pass.cpp : condition_variable__dtor_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/native_handle_pass.cpp : condition_variable__native_handle_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_for_pass.cpp : condition_variable__wait_for_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_for_pred_pass.cpp : condition_variable__wait_for_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_until_pass.cpp : condition_variable__wait_until_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_until_pred_pass.cpp : condition_variable__wait_until_pred_p ]
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable/assign_fail.cpp : : conditions__condition_variable__assign_f ]
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable/copy_fail.cpp : : conditions__condition_variable__copy_f ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/default_pass.cpp : conditions__condition_variable__default_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/dtor_pass.cpp : conditions__condition_variable__dtor_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/native_handle_pass.cpp : conditions__condition_variable__native_handle_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_for_pass.cpp : conditions__condition_variable__wait_for_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_for_pred_pass.cpp : conditions__condition_variable__wait_for_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_until_pass.cpp : conditions__condition_variable__wait_until_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable/wait_until_pred_pass.cpp : conditions__condition_variable__wait_until_pred_p ]
|
||||
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/assign_fail.cpp : : condition_variable_any__assign_f ]
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/copy_fail.cpp : : condition_variable_any__copy_f ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/default_pass.cpp : condition_variable_any__default_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/dtor_pass.cpp : condition_variable_any__dtor_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pass.cpp : condition_variable_any__wait_for_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pred_pass.cpp : condition_variable_any__wait_for_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pass.cpp : condition_variable_any__wait_until_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pred_pass.cpp : condition_variable_any__wait_until_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/cv_status/cv_status_pass.cpp : cv_status__cv_status_p ]
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/assign_fail.cpp : : conditions__condition_variable_any__assign_f ]
|
||||
[ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/copy_fail.cpp : : conditions__condition_variable_any__copy_f ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/default_pass.cpp : conditions__condition_variable_any__default_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/dtor_pass.cpp : conditions__condition_variable_any__dtor_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pass.cpp : conditions__condition_variable_any__wait_for_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pred_pass.cpp : conditions__condition_variable_any__wait_for_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pass.cpp : conditions__condition_variable_any__wait_until_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pred_pass.cpp : conditions__condition_variable_any__wait_until_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/cv_status/cv_status_pass.cpp : conditions__cv_status__cv_status_p ]
|
||||
;
|
||||
|
||||
#explicit futures ;
|
||||
test-suite futures
|
||||
:
|
||||
# [ thread-run2 ./sync/futures/async/async_pass.cpp : async__async_p ]
|
||||
[ thread-compile-fail-V2 ./sync/futures/promise/copy_assign_fail.cpp : : promise__copy_assign_f ]
|
||||
[ thread-run2 ./sync/futures/promise/default_pass.cpp : promise__default_p ]
|
||||
[ thread-run2 ./sync/futures/promise/dtor_pass.cpp : promise__dtor_p ]
|
||||
[ thread-run2 ./sync/futures/promise/get_future_pass.cpp : promise__get_future_p ]
|
||||
[ thread-run2 ./sync/futures/promise/move_ctor_pass.cpp : promise__move_ctor_p ]
|
||||
[ thread-run2 ./sync/futures/promise/move_assign_pass.cpp : promise__move_asign_p ]
|
||||
|
||||
[ thread-run2 ./sync/futures/future/share_pass.cpp : future__share_p ]
|
||||
|
||||
# [ thread-run2 ./sync/futures/async/async_pass.cpp : futures__async__async_p ]
|
||||
[ thread-run2 ./sync/futures/promise/default_pass.cpp : futures__promise__default_p ]
|
||||
[ thread-run2 ./sync/futures/promise/dtor_pass.cpp : futures__promise__dtor_p ]
|
||||
[ thread-run2 ./sync/futures/promise/get_future_pass.cpp : futures__promise__get_future_p ]
|
||||
;
|
||||
|
||||
|
||||
@@ -163,11 +157,11 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
test-suite mutual_exclusion
|
||||
:
|
||||
#uncomment the following once these works on windows
|
||||
[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp : : lock_guard__cons__copy_assign_f ]
|
||||
[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/lock_guard/copy_ctor_fail.cpp : : lock_guard__cons__copy_ctor_f ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/adopt_lock_pass.cpp : lock_guard__cons__adopt_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/default_pass.cpp : lock_guard__cons__default_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/types_pass.cpp : lock_guard__types_p ]
|
||||
#[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp : : lock_guard__cons__copy_assign_f ]
|
||||
#[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/lock_guard/copy_ctor_fail.cpp : : lock_guard__cons__copy_ctor_f ]
|
||||
#[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/adopt_lock_pass.cpp : lock_guard__cons__adopt_lock_p ]
|
||||
#[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/default_pass.cpp : lock_guard__cons__default_p ]
|
||||
#[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/types_pass.cpp : lock_guard__types_p ]
|
||||
|
||||
[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/unique_lock/cons/copy_assign_fail.cpp : : unique_lock__cons__copy_assign_f ]
|
||||
[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/unique_lock/cons/copy_ctor_fail.cpp : : unique_lock__cons__copy_ctor_f ]
|
||||
@@ -177,26 +171,20 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/duration_pass.cpp : unique_lock__cons__duration_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_assign_pass.cpp : unique_lock__cons__move_assign_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_pass.cpp : unique_lock__cons__move_ctor_p ]
|
||||
|
||||
#uncomment the following once these works on windows
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_upgrade_lock_pass.cpp : unique_lock__cons__move_ctor_upgrade_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_upgrade_lock_try_pass.cpp : unique_lock__cons__move_ctor_upgrade_lock_try_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_upgrade_lock_for_pass.cpp : unique_lock__cons__move_ctor_upgrade_lock_for_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_upgrade_lock_until_pass.cpp : unique_lock__cons__move_ctor_upgrade_lock_until_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/mutex_pass.cpp : unique_lock__cons__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp : unique_lock__cons__time_point_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/try_to_lock_pass.cpp : unique_lock__cons__try_to_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/lock_pass.cpp : unique_lock__lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_for_pass.cpp : unique_lock__try_lock_for_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_pass.cpp : unique_lock__try_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_until_pass.cpp : unique_lock__try_lock_until_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/unlock_pass.cpp : unique_lock__unlock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/member_swap_pass.cpp : unique_lock__member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/non_member_swap_pass.cpp : unique_lock__non_member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/release_pass.cpp : unique_lock__release_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/mutex_pass.cpp : unique_lock__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/op_bool_pass.cpp : unique_lock__op_bool_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp : unique_lock__owns_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/lock_pass.cpp : unique_lock__locking__lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_for_pass.cpp : unique_lock__locking__try_lock_for_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_pass.cpp : unique_lock__locking__try_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_until_pass.cpp : unique_lock__locking__try_lock_until_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/unlock_pass.cpp : unique_lock__locking__unlock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/member_swap_pass.cpp : unique_lock__mod__member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/non_member_swap_pass.cpp : unique_lock__mod__non_member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/release_pass.cpp : unique_lock__mod__release_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/mutex_pass.cpp : unique_lock__obs__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/op_bool_pass.cpp : unique_lock__obs__op_bool_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp : unique_lock__obs__owns_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/types_pass.cpp : unique_lock__types_p ]
|
||||
|
||||
[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/shared_lock/cons/copy_assign_fail.cpp : : shared_lock__cons__copy_assign_f ]
|
||||
@@ -207,24 +195,20 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/duration_pass.cpp : shared_lock__cons__duration_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_assign_pass.cpp : shared_lock__cons__move_assign_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_ctor_pass.cpp : shared_lock__cons__move_ctor_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_ctor_unique_lock_pass.cpp : shared_lock__cons__move_ctor_unique_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_ctor_upgrade_lock_pass.cpp : shared_lock__cons__move_ctor_upgrade_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/mutex_pass.cpp : shared_lock__cons__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/time_point_pass.cpp : shared_lock__cons__time_point_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/try_to_lock_pass.cpp : shared_lock__cons__try_to_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/lock_pass.cpp : shared_lock__lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_for_pass.cpp : shared_lock__try_lock_for_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_pass.cpp : shared_lock__try_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_until_pass.cpp : shared_lock__try_lock_until_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/unlock_pass.cpp : shared_lock__unlock_p ]
|
||||
|
||||
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/member_swap_pass.cpp : shared_lock__member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/non_member_swap_pass.cpp : shared_lock__non_member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/release_pass.cpp : shared_lock__release_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/mutex_pass.cpp : shared_lock__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/op_bool_pass.cpp : shared_lock__op_bool_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/owns_lock_pass.cpp : shared_lock__owns_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/lock_pass.cpp : shared_lock__locking__lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_for_pass.cpp : shared_lock__locking__try_lock_for_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_pass.cpp : shared_lock__locking__try_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_until_pass.cpp : shared_lock__locking__try_lock_until_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/unlock_pass.cpp : shared_lock__locking__unlock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/member_swap_pass.cpp : shared_lock__mod__member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/non_member_swap_pass.cpp : shared_lock__mod__non_member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/release_pass.cpp : shared_lock__mod__release_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/mutex_pass.cpp : shared_lock__obs__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/op_bool_pass.cpp : shared_lock__obs__op_bool_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/owns_lock_pass.cpp : shared_lock__obs__owns_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/types_pass.cpp : shared_lock__types_p ]
|
||||
|
||||
[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/copy_assign_fail.cpp : : upgrade_lock__cons__copy_assign_f ]
|
||||
@@ -235,21 +219,20 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/duration_pass.cpp : upgrade_lock__cons__duration_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_assign_pass.cpp : upgrade_lock__cons__move_assign_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_pass.cpp : upgrade_lock__cons__move_ctor_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_unique_lock_pass.cpp : upgrade_lock__cons__move_ctor_unique_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/mutex_pass.cpp : upgrade_lock__cons__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/time_point_pass.cpp : upgrade_lock__cons__time_point_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/try_to_lock_pass.cpp : upgrade_lock__cons__try_to_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/lock_pass.cpp : upgrade_lock__lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_for_pass.cpp : upgrade_lock__try_lock_for_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_pass.cpp : upgrade_lock__try_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_until_pass.cpp : upgrade_lock__try_lock_until_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/unlock_pass.cpp : upgrade_lock__unlock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/member_swap_pass.cpp : upgrade_lock__member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/non_member_swap_pass.cpp : upgrade_lock__non_member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/release_pass.cpp : upgrade_lock__release_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/mutex_pass.cpp : upgrade_lock__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/op_bool_pass.cpp : upgrade_lock__op_bool_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/owns_lock_pass.cpp : upgrade_lock__owns_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/lock_pass.cpp : upgrade_lock__locking__lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_for_pass.cpp : upgrade_lock__locking__try_lock_for_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_pass.cpp : upgrade_lock__locking__try_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_until_pass.cpp : upgrade_lock__locking__try_lock_until_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/unlock_pass.cpp : upgrade_lock__locking__unlock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/member_swap_pass.cpp : upgrade_lock__mod__member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/non_member_swap_pass.cpp : upgrade_lock__mod__non_member_swap_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/release_pass.cpp : upgrade_lock__mod__release_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/mutex_pass.cpp : upgrade_lock__obs__mutex_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/op_bool_pass.cpp : upgrade_lock__obs__op_bool_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/owns_lock_pass.cpp : upgrade_lock__obs__owns_lock_p ]
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp : upgrade_lock__types_p ]
|
||||
|
||||
[ thread-compile-fail-V2 ./sync/mutual_exclusion/mutex/assign_fail.cpp : : mutex__assign_f ]
|
||||
@@ -315,17 +298,17 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
[ thread-run2 ./threads/thread/constr/move_pass.cpp : thread__constr__move_p ]
|
||||
[ thread-run2 ./threads/thread/destr/dtor_pass.cpp : thread__destr__dtor_p ]
|
||||
[ thread-run2 ./threads/thread/id/hash_pass.cpp : thread__id__hash_p ]
|
||||
[ thread-run2 ./threads/thread/members/detach_pass.cpp : thread__detach_p ]
|
||||
[ thread-run2 ./threads/thread/members/get_id_pass.cpp : thread__get_id_p ]
|
||||
[ thread-run2 ./threads/thread/members/join_pass.cpp : thread__join_p ]
|
||||
[ thread-run2 ./threads/thread/members/joinable_pass.cpp : thread__joinable_p ]
|
||||
[ thread-run2 ./threads/thread/members/native_handle_pass.cpp : thread__native_handle_p ]
|
||||
[ thread-run2 ./threads/thread/members/swap_pass.cpp : thread__swap_p ]
|
||||
[ thread-run2 ./threads/thread/non_members/swap_pass.cpp : swap_threads_p ]
|
||||
[ thread-run2 ./threads/thread/static/hardware_concurrency_pass.cpp : thread__hardware_concurrency_p ]
|
||||
[ thread-run2 ./threads/thread/members/detach_pass.cpp : thread__members__detach_p ]
|
||||
[ thread-run2 ./threads/thread/members/get_id_pass.cpp : thread__members__get_id_p ]
|
||||
[ thread-run2 ./threads/thread/members/join_pass.cpp : thread__members__join_p ]
|
||||
[ thread-run2 ./threads/thread/members/joinable_pass.cpp : thread__members__joinable_p ]
|
||||
[ thread-run2 ./threads/thread/members/native_handle_pass.cpp : thread__members__native_handle_p ]
|
||||
[ thread-run2 ./threads/thread/members/swap_pass.cpp : thread__members__swap_p ]
|
||||
[ thread-run2 ./threads/thread/non_members/swap_pass.cpp : thread__non_members__swap_p ]
|
||||
[ thread-run2 ./threads/thread/static/hardware_concurrency_pass.cpp : thread__static__hardware_concurrency_p ]
|
||||
;
|
||||
|
||||
explicit examples ;
|
||||
#explicit examples ;
|
||||
test-suite examples
|
||||
:
|
||||
[ thread-run ../example/monitor.cpp ]
|
||||
@@ -340,20 +323,14 @@ rule thread-compile-fail-V2 ( sources : reqs * : name )
|
||||
[ thread-run ../example/tss.cpp ]
|
||||
[ thread-run ../example/xtime.cpp ]
|
||||
[ thread-run ../example/shared_monitor.cpp ]
|
||||
#[ thread-run ../example/shared_mutex.cpp ]
|
||||
[ thread-run ../example/shared_mutex.cpp ]
|
||||
#[ thread-run ../example/v2_shared_monitor.cpp ]
|
||||
#[ thread-run ../example/v2_shared_mutex.cpp ]
|
||||
;
|
||||
|
||||
#explicit shared_upwards ;
|
||||
#test-suite shared_upwards
|
||||
#:
|
||||
# [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_shared_lock_try_pass.cpp : unique_lock__cons__move_ctor_shared_lock_try_p ]
|
||||
# [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_shared_lock_for_pass.cpp : unique_lock__cons__move_ctor_shared_lock_for_p ]
|
||||
# [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_shared_lock_until_pass.cpp : unique_lock__cons__move_ctor_shared_lock_until_p ]
|
||||
#
|
||||
# [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_shared_lock_try_pass.cpp : upgrade_lock__cons__move_ctor_shared_lock_try_p ]
|
||||
# [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_shared_lock_for_pass.cpp : upgrade_lock__cons__move_ctor_shared_lock_for_p ]
|
||||
# [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_shared_lock_until_pass.cpp : upgrade_lock__cons__move_ctor_shared_lock_until_p ]
|
||||
#;
|
||||
explicit ttt ;
|
||||
test-suite ttt
|
||||
:
|
||||
#[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_upgrade_lock_pass.cpp : unique_lock__cons__move_ctor_upgrade_lock_p ]
|
||||
;
|
||||
}
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/future.hpp>
|
||||
|
||||
// class future<R>
|
||||
|
||||
// shared_future<R> share() &&;
|
||||
|
||||
#define BOOST_THREAD_VERSION 2
|
||||
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
{
|
||||
typedef int T;
|
||||
boost::promise<T> p;
|
||||
boost::future<T> f0 = p.get_future();
|
||||
boost::shared_future<T> sf = f0.share();
|
||||
boost::shared_future<T> f = sf;
|
||||
BOOST_TEST(!f0.valid());
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
{
|
||||
typedef int T;
|
||||
boost::future<T> f0;
|
||||
boost::shared_future<T> sf = f0.share();
|
||||
boost::shared_future<T> f = sf;
|
||||
BOOST_TEST(!f0.valid());
|
||||
BOOST_TEST(!f.valid());
|
||||
}
|
||||
{
|
||||
typedef int& T;
|
||||
boost::promise<T> p;
|
||||
boost::future<T> f0 = p.get_future();
|
||||
boost::shared_future<T> sf = f0.share();
|
||||
boost::shared_future<T> f = sf;
|
||||
BOOST_TEST(!f0.valid());
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
{
|
||||
typedef int& T;
|
||||
boost::future<T> f0;
|
||||
boost::shared_future<T> sf = f0.share();
|
||||
boost::shared_future<T> f = sf;
|
||||
BOOST_TEST(!f0.valid());
|
||||
BOOST_TEST(!f.valid());
|
||||
}
|
||||
{
|
||||
typedef void T;
|
||||
boost::promise<T> p;
|
||||
boost::future<T> f0 = p.get_future();
|
||||
boost::shared_future<T> sf = f0.share();
|
||||
boost::shared_future<T> f = sf;
|
||||
BOOST_TEST(!f0.valid());
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
{
|
||||
typedef void T;
|
||||
boost::future<T> f0;
|
||||
boost::shared_future<T> sf = f0.share();
|
||||
boost::shared_future<T> f = sf;
|
||||
BOOST_TEST(!f0.valid());
|
||||
BOOST_TEST(!f.valid());
|
||||
}
|
||||
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
32
test/sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_unique_lock_pass.cpp → test/sync/futures/promise/copy_asign_fail.cpp
Normal file → Executable file
32
test/sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_unique_lock_pass.cpp → test/sync/futures/promise/copy_asign_fail.cpp
Normal file → Executable file
@@ -12,33 +12,29 @@
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/locks.hpp>
|
||||
// <boost/thread/future.hpp>
|
||||
|
||||
// template <class Mutex> class upgrade_lock;
|
||||
|
||||
// upgrade_lock& operator=(unique_lock&& u);
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::shared_mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> lk0(m);
|
||||
boost::upgrade_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
boost::promise<int> p;
|
||||
boost::future<int> f = p.get_future();
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::shared_mutex> lk( (boost::unique_lock<boost::shared_mutex>(m)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
boost::promise<int&> p;
|
||||
boost::future<int&> f = p.get_future();
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
{
|
||||
boost::promise<void> p;
|
||||
boost::future<void> f = p.get_future();
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
@@ -1,100 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/future.hpp>
|
||||
// class promise<R>
|
||||
// promise& operator=(const promise& rhs) = delete;
|
||||
|
||||
#define BOOST_THREAD_VERSION 2
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
{
|
||||
//boost::promise<int> p0(boost::allocator_arg, test_allocator<int>());
|
||||
//boost::promise<int> p(boost::allocator_arg, test_allocator<int>());
|
||||
boost::promise<int> p0;
|
||||
boost::promise<int> p;
|
||||
//BOOST_TEST(test_alloc_base::count == 2);
|
||||
p = p0;
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
boost::future<int> f = p.get_future();
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
BOOST_TEST(f.valid());
|
||||
try
|
||||
{
|
||||
f = p0.get_future();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (const boost::future_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
// {
|
||||
// //boost::promise<int&> p0(boost::allocator_arg, test_allocator<int>());
|
||||
// //boost::promise<int&> p(boost::allocator_arg, test_allocator<int>());
|
||||
// boost::promise<int&> p0;
|
||||
// boost::promise<int&> p;
|
||||
// //BOOST_TEST(test_alloc_base::count == 2);
|
||||
// p = p0;
|
||||
// //BOOST_TEST(test_alloc_base::count == 1);
|
||||
// boost::future<int&> f = p.get_future();
|
||||
// //BOOST_TEST(test_alloc_base::count == 1);
|
||||
// BOOST_TEST(f.valid());
|
||||
// try
|
||||
// {
|
||||
// f = p0.get_future();
|
||||
// BOOST_TEST(false);
|
||||
// }
|
||||
// catch (const boost::future_error& e)
|
||||
// {
|
||||
// BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
// }
|
||||
// //BOOST_TEST(test_alloc_base::count == 1);
|
||||
// }
|
||||
// //BOOST_TEST(test_alloc_base::count == 0);
|
||||
// {
|
||||
// //boost::promise<void> p0(boost::allocator_arg, test_allocator<void>());
|
||||
// //boost::promise<void> p(boost::allocator_arg, test_allocator<void>());
|
||||
// boost::promise<void> p0;
|
||||
// boost::promise<void> p;
|
||||
// //BOOST_TEST(test_alloc_base::count == 2);
|
||||
// p = p0;
|
||||
// //BOOST_TEST(test_alloc_base::count == 1);
|
||||
// boost::future<void> f = p.get_future();
|
||||
// //BOOST_TEST(test_alloc_base::count == 1);
|
||||
// BOOST_TEST(f.valid());
|
||||
// try
|
||||
// {
|
||||
// f = p0.get_future();
|
||||
// BOOST_TEST(false);
|
||||
// }
|
||||
// catch (const boost::future_error& e)
|
||||
// {
|
||||
// BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
// }
|
||||
// //BOOST_TEST(test_alloc_base::count == 1);
|
||||
// }
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -25,25 +25,20 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << __LINE__ << std::endl;
|
||||
|
||||
{
|
||||
boost::promise<int> p;
|
||||
boost::future<int> f = p.get_future();
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
boost::promise<int&> p;
|
||||
boost::future<int&> f = p.get_future();
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
boost::promise<void> p;
|
||||
std::cout << __LINE__ << std::endl;
|
||||
boost::future<void> f = p.get_future();
|
||||
std::cout << __LINE__ << std::endl;
|
||||
BOOST_TEST(f.valid());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
typedef int T;
|
||||
boost::future<T> f;
|
||||
@@ -36,7 +35,6 @@ int main()
|
||||
}
|
||||
BOOST_TEST(f.get() == 3);
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
typedef int T;
|
||||
boost::future<T> f;
|
||||
@@ -55,7 +53,6 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
typedef int& T;
|
||||
int i = 4;
|
||||
@@ -67,7 +64,6 @@ int main()
|
||||
}
|
||||
BOOST_TEST(&f.get() == &i);
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
typedef int& T;
|
||||
boost::future<T> f;
|
||||
@@ -86,7 +82,6 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
typedef void T;
|
||||
boost::future<T> f;
|
||||
@@ -98,7 +93,6 @@ int main()
|
||||
f.get();
|
||||
BOOST_TEST(true);
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
{
|
||||
typedef void T;
|
||||
boost::future<T> f;
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <future>
|
||||
|
||||
// class promise<R>
|
||||
|
||||
// promise& operator=(promise&& rhs);
|
||||
|
||||
#define BOOST_THREAD_VERSION 2
|
||||
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::mutex m0;
|
||||
boost::mutex m1;
|
||||
|
||||
int main()
|
||||
{
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
{
|
||||
//boost::promise<int> p0(boost::allocator_arg, test_allocator<int>());
|
||||
//boost::promise<int> p(boost::allocator_arg, test_allocator<int>());
|
||||
boost::promise<int> p0;
|
||||
boost::promise<int> p;
|
||||
//BOOST_TEST(test_alloc_base::count == 2);
|
||||
p = boost::move(p0);
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
boost::future<int> f = p.get_future();
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
BOOST_TEST(f.valid());
|
||||
try
|
||||
{
|
||||
f = p0.get_future();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (const boost::future_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
{
|
||||
//boost::promise<int&> p0(boost::allocator_arg, test_allocator<int>());
|
||||
//boost::promise<int&> p(boost::allocator_arg, test_allocator<int>());
|
||||
boost::promise<int&> p0;
|
||||
boost::promise<int&> p;
|
||||
//BOOST_TEST(test_alloc_base::count == 2);
|
||||
p = boost::move(p0);
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
boost::future<int&> f = p.get_future();
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
BOOST_TEST(f.valid());
|
||||
try
|
||||
{
|
||||
f = p0.get_future();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (const boost::future_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
{
|
||||
//boost::promise<void> p0(boost::allocator_arg, test_allocator<void>());
|
||||
//boost::promise<void> p(boost::allocator_arg, test_allocator<void>());
|
||||
boost::promise<void> p0;
|
||||
boost::promise<void> p;
|
||||
//BOOST_TEST(test_alloc_base::count == 2);
|
||||
p = boost::move(p0);
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
boost::future<void> f = p.get_future();
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
BOOST_TEST(f.valid());
|
||||
try
|
||||
{
|
||||
f = p0.get_future();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (const boost::future_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
|
||||
return boost::report_errors();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <future>
|
||||
|
||||
// class promise<R>
|
||||
|
||||
// promise(promise&& rhs);
|
||||
|
||||
#define BOOST_THREAD_VERSION 2
|
||||
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << __LINE__ << std::endl;
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
{
|
||||
//boost::promise<int> p0(boost::allocator_arg, test_allocator<int>());
|
||||
//boost::promise<int> p(boost::move(p0));
|
||||
boost::promise<int> p0;
|
||||
boost::promise<int> p(boost::move(p0));
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
std::cout << __LINE__ << std::endl;
|
||||
boost::future<int> f = p.get_future();
|
||||
std::cout << __LINE__ << std::endl;
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
BOOST_TEST(f.valid());
|
||||
std::cout << __LINE__ << std::endl;
|
||||
try
|
||||
{
|
||||
f = p0.get_future();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (const boost::future_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
{
|
||||
//boost::promise<int&> p0(boost::allocator_arg, test_allocator<int>());
|
||||
//boost::promise<int&> p(boost::move(p0));
|
||||
boost::promise<int&> p0;
|
||||
boost::promise<int&> p(boost::move(p0));
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
boost::future<int&> f = p.get_future();
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
BOOST_TEST(f.valid());
|
||||
try
|
||||
{
|
||||
f = p0.get_future();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (const boost::future_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
{
|
||||
//boost::promise<void> p0(boost::allocator_arg, test_allocator<void>());
|
||||
//boost::promise<void> p(boost::move(p0));
|
||||
boost::promise<void> p0;
|
||||
boost::promise<void> p(boost::move(p0));
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
boost::future<void> f = p.get_future();
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
BOOST_TEST(f.valid());
|
||||
try
|
||||
{
|
||||
f = p0.get_future();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (const boost::future_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code() == boost::system::make_error_code(boost::future_errc::no_state));
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 1);
|
||||
}
|
||||
//BOOST_TEST(test_alloc_base::count == 0);
|
||||
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,33 @@ int main()
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> lk0(m);
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::unique_lock<boost::shared_mutex>(m)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
|
||||
{
|
||||
boost::upgrade_lock<boost::shared_mutex> lk0(m);
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::upgrade_lock<boost::shared_mutex>(m)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/locks.hpp>
|
||||
|
||||
// template <class Mutex> class shared_lock;
|
||||
|
||||
// shared_lock& operator=(shared_lock&& u);
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::shared_mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> lk0(m);
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::unique_lock<boost::shared_mutex>(m)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> lk0(m, boost::defer_lock);
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> lk0(m, boost::defer_lock);
|
||||
lk0.release();
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == 0);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/locks.hpp>
|
||||
|
||||
// template <class Mutex> class shared_lock;
|
||||
|
||||
// shared_lock& operator=(shared_lock&& u);
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::shared_mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
{
|
||||
boost::upgrade_lock<boost::shared_mutex> lk0(m);
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::upgrade_lock<boost::shared_mutex>(m)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::shared_mutex> lk0(m, boost::defer_lock);
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::shared_mutex> lk0(m, boost::defer_lock);
|
||||
lk0.release();
|
||||
boost::shared_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == 0);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
// };
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// template <class Mutex> class unique_lock;
|
||||
|
||||
// unique_lock(unique_lock&& u);
|
||||
// unique_lock& operator=(unique_lock&& u);
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
@@ -40,23 +40,6 @@ int main()
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk0(m, boost::defer_lock);
|
||||
boost::unique_lock<boost::mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk0(m, boost::defer_lock);
|
||||
lk0.release();
|
||||
boost::unique_lock<boost::mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == 0);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/locks.hpp>
|
||||
|
||||
// template <class Mutex> class unique_lock;
|
||||
|
||||
// template <class Clock, class Duration>
|
||||
// unique_lock(shared_lock<mutex_type>&&,
|
||||
// const chrono::duration<Rep, Period>&);
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::upgrade_mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk(boost::move(lk0), boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::upgrade_mutex>
|
||||
lk(boost::upgrade_lock<boost::upgrade_mutex>(m), boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk(boost::move(lk0), boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
lk0.release();
|
||||
boost::unique_lock<boost::upgrade_mutex> lk(boost::move(lk0), boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == 0);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/locks.hpp>
|
||||
|
||||
// template <class Mutex> class unique_lock;
|
||||
|
||||
// unique_lock(upgrade_lock&& u);
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::upgrade_mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::upgrade_mutex> lk( (boost::upgrade_lock<boost::upgrade_mutex>(m)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
lk0.release();
|
||||
boost::unique_lock<boost::upgrade_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == 0);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/locks.hpp>
|
||||
|
||||
// template <class Mutex> class unique_lock;
|
||||
|
||||
// unique_lock(upgrade_lock&& u, try_to_lock);
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::upgrade_mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk(boost::move(lk0), boost::try_to_lock );
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::upgrade_mutex> lk(boost::upgrade_lock<boost::upgrade_mutex>(m), boost::try_to_lock);
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk(boost::move(lk0), boost::try_to_lock);
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
lk0.release();
|
||||
boost::unique_lock<boost::upgrade_mutex> lk(boost::move(lk0), boost::try_to_lock);
|
||||
BOOST_TEST(lk.mutex() == 0);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/locks.hpp>
|
||||
|
||||
// template <class Mutex> class unique_lock;
|
||||
|
||||
// template <class Clock, class Duration>
|
||||
// unique_lock(shared_lock<mutex_type>&&,
|
||||
// const chrono::time_point<Clock, Duration>&);
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::upgrade_mutex m;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk( boost::move(lk0), boost::chrono::steady_clock::now()+boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::upgrade_mutex>
|
||||
lk( boost::upgrade_lock<boost::upgrade_mutex>(m), boost::chrono::steady_clock::now()+boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
boost::unique_lock<boost::upgrade_mutex> lk( boost::move(lk0), boost::chrono::steady_clock::now()+boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::upgrade_mutex> lk0(m, boost::defer_lock);
|
||||
lk0.release();
|
||||
boost::unique_lock<boost::upgrade_mutex> lk( boost::move(lk0), boost::chrono::steady_clock::now()+boost::chrono::milliseconds(1));
|
||||
BOOST_TEST(lk.mutex() == 0);
|
||||
BOOST_TEST(lk.owns_lock() == false);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,19 @@ int main()
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::shared_mutex> lk0(m);
|
||||
boost::upgrade_lock<boost::shared_mutex> lk( (boost::move(lk0)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
BOOST_TEST(lk0.mutex() == 0);
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
{
|
||||
boost::upgrade_lock<boost::shared_mutex> lk( (boost::unique_lock<boost::shared_mutex>(m)));
|
||||
BOOST_TEST(lk.mutex() == &m);
|
||||
BOOST_TEST(lk.owns_lock() == true);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
// };
|
||||
|
||||
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
Reference in New Issue
Block a user