|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75858 - trunk/boost/thread/detail
From: vicente.botet_at_[hidden]
Date: 2011-12-07 16:08:53
Author: viboes
Date: 2011-12-07 16:08:52 EST (Wed, 07 Dec 2011)
New Revision: 75858
URL: http://svn.boost.org/trac/boost/changeset/75858
Log:
Thread: boost thread unit test module bug on Microsoft Visual Studio debug mode
Text files modified:
trunk/boost/thread/detail/thread.hpp | 84 ++++++++++++++++++++-------------------
1 files changed, 44 insertions(+), 40 deletions(-)
Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2011-12-07 16:08:52 EST (Wed, 07 Dec 2011)
@@ -4,7 +4,7 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// (C) Copyright 2007-10 Anthony Williams
-
+
#include <boost/thread/exceptions.hpp>
#ifndef BOOST_NO_IOSTREAM
#include <ostream>
@@ -55,7 +55,7 @@
thread_data(detail::thread_move_t<F> f_):
f(f_)
{}
-#endif
+#endif
void run()
{
f();
@@ -80,7 +80,7 @@
thread_data(boost::reference_wrapper<F> f_):
f(f_)
{}
-
+
void run()
{
f();
@@ -99,14 +99,14 @@
thread_data(const boost::reference_wrapper<F> f_):
f(f_)
{}
-
+
void run()
{
f();
}
};
}
-
+
class BOOST_THREAD_DECL thread
{
private:
@@ -114,11 +114,11 @@
thread& operator=(thread&);
void release_handle();
-
+
detail::thread_data_ptr thread_info;
void start_thread();
-
+
explicit thread(detail::thread_data_ptr data);
detail::thread_data_ptr get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const;
@@ -149,8 +149,8 @@
struct dummy;
public:
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
- thread(const volatile thread&);
-#endif
+ thread(const volatile thread&);
+#endif
thread();
~thread();
@@ -175,7 +175,7 @@
{
thread_info.swap(other.thread_info);
}
-
+
thread& operator=(thread&& other)
{
thread_info=other.thread_info;
@@ -187,7 +187,7 @@
{
return static_cast<thread&&>(*this);
}
-
+
#else
#ifdef BOOST_NO_SFINAE
template <class F>
@@ -204,7 +204,7 @@
start_thread();
}
#endif
-
+
template <class F>
explicit thread(detail::thread_move_t<F> f):
thread_info(make_thread_info(f))
@@ -217,13 +217,13 @@
thread_info=x->thread_info;
x->thread_info.reset();
}
-
+
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
- thread& operator=(thread x)
- {
- swap(x);
- return *this;
- }
+ thread& operator=(thread x)
+ {
+ swap(x);
+ return *this;
+ }
#else
thread& operator=(detail::thread_move_t<thread> x)
{
@@ -231,12 +231,12 @@
swap(new_thread);
return *this;
}
-#endif
+#endif
operator detail::thread_move_t<thread>()
{
return move();
}
-
+
detail::thread_move_t<thread> move()
{
detail::thread_move_t<thread> x(*this);
@@ -340,7 +340,7 @@
{
this_thread::yield();
}
-
+
static inline void sleep(const system_time& xt)
{
this_thread::sleep(xt);
@@ -355,7 +355,7 @@
{
return lhs.swap(rhs);
}
-
+
#ifndef BOOST_NO_RVALUE_REFERENCES
inline thread&& move(thread& t)
{
@@ -390,7 +390,7 @@
{
private:
detail::thread_data_ptr thread_data;
-
+
id(detail::thread_data_ptr thread_data_):
thread_data(thread_data_)
{}
@@ -400,32 +400,36 @@
id():
thread_data()
{}
-
+
+ id(const id& other):
+ thread_data(other.thread_data)
+ {}
+
bool operator==(const id& y) const
{
return thread_data==y.thread_data;
}
-
+
bool operator!=(const id& y) const
{
return thread_data!=y.thread_data;
}
-
+
bool operator<(const id& y) const
{
return thread_data<y.thread_data;
}
-
+
bool operator>(const id& y) const
{
return y.thread_data<thread_data;
}
-
+
bool operator<=(const id& y) const
{
return !(y.thread_data<thread_data);
}
-
+
bool operator>=(const id& y) const
{
return !(thread_data<y.thread_data);
@@ -435,12 +439,12 @@
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
template<class charT, class traits>
friend BOOST_SYMBOL_VISIBLE
- std::basic_ostream<charT, traits>&
+ std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const id& x)
{
if(x.thread_data)
{
- return os<<x.thread_data;
+ return os<< std::hex << x.thread_data;
}
else
{
@@ -450,7 +454,7 @@
#else
template<class charT, class traits>
BOOST_SYMBOL_VISIBLE
- std::basic_ostream<charT, traits>&
+ std::basic_ostream<charT, traits>&
print(std::basic_ostream<charT, traits>& os) const
{
if(thread_data)
@@ -470,7 +474,7 @@
#if !defined(BOOST_NO_IOSTREAM) && defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template<class charT, class traits>
BOOST_SYMBOL_VISIBLE
- std::basic_ostream<charT, traits>&
+ std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const thread::id& x)
{
return x.print(os);
@@ -481,12 +485,12 @@
{
return get_id()==other.get_id();
}
-
+
inline bool thread::operator!=(const thread& other) const
{
return get_id()!=other.get_id();
}
-
+
namespace detail
{
struct thread_exit_function_base
@@ -495,26 +499,26 @@
{}
virtual void operator()()=0;
};
-
+
template<typename F>
struct thread_exit_function:
thread_exit_function_base
{
F f;
-
+
thread_exit_function(F f_):
f(f_)
{}
-
+
void operator()()
{
f();
}
};
-
+
void BOOST_THREAD_DECL add_thread_exit_function(thread_exit_function_base*);
}
-
+
namespace this_thread
{
template<typename F>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk