// <thread> -*- C++ -*-
-// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-/** @file thread
+/** @file include/thread
* This is a Standard C++ Library header.
*/
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
-namespace std
+namespace std _GLIBCXX_VISIBILITY(default)
{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
/**
* @defgroup threads Threads
* @ingroup concurrency
{
__shared_base_type _M_this_ptr;
- inline virtual ~_Impl_base();
+ virtual ~_Impl_base();
virtual void _M_run() = 0;
};
thread(thread&& __t)
{ swap(__t); }
- template<typename _Callable>
- explicit thread(_Callable __f)
- {
- _M_start_thread(_M_make_routine<_Callable>
- (std::forward<_Callable>(__f)));
- }
-
template<typename _Callable, typename... _Args>
+ explicit
thread(_Callable&& __f, _Args&&... __args)
- { _M_start_thread(_M_make_routine(std::bind(__f, __args...))); }
+ {
+ _M_start_thread(_M_make_routine(std::bind<void>(
+ std::forward<_Callable>(__f),
+ std::forward<_Args>(__args)...)));
+ }
~thread()
{
}
};
- inline thread::_Impl_base::~_Impl_base() = default;
-
inline void
swap(thread& __x, thread& __y)
{ __x.swap(__y); }
return __out << __id._M_thread;
}
+_GLIBCXX_END_NAMESPACE_VERSION
+
/** @namespace std::this_thread
* @brief ISO C++ 0x entities sub namespace for thread.
* 30.2.2 Namespace this_thread.
*/
namespace this_thread
{
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
/// get_id
inline thread::id
get_id() { return thread::id(__gthread_self()); }
::nanosleep(&__ts, 0);
}
#endif
+
+ _GLIBCXX_END_NAMESPACE_VERSION
}
// @} group threads
-}
+
+} // namespace
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1