summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/std/mutex
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-08 00:44:12 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-08 00:44:12 +0000
commit7746395bf4adaf161ab72b1111efc21f938e587b (patch)
tree223378819d65a4a1a8fd8097258e549d4a14ed6f /libstdc++-v3/include/std/mutex
parent888a3210cd1aa01e0e845e2802561e7138340313 (diff)
downloadppe42-gcc-7746395bf4adaf161ab72b1111efc21f938e587b.tar.gz
ppe42-gcc-7746395bf4adaf161ab72b1111efc21f938e587b.zip
2010-10-08 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/45893 * include/std/functional (bind): Implement DR 817 and add support for volatile-qualified call wrappers. * include/std/mutex (call_once): Implement DR 891. * include/std/thread (thread::thread): Implement DR 929. * include/std/future: Optimise use of std::bind. * testsuite/20_util/bind/cv_quals.cc: Test volatile-qualification. * testsuite/20_util/bind/move.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165144 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/mutex')
-rw-r--r--libstdc++-v3/include/std/mutex10
1 files changed, 6 insertions, 4 deletions
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index b236f0db91d..c11ddd44668 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -690,7 +690,7 @@ namespace std
template<typename _Callable, typename... _Args>
friend void
- call_once(once_flag& __once, _Callable __f, _Args&&... __args);
+ call_once(once_flag& __once, _Callable&& __f, _Args&&... __args);
};
#ifdef _GLIBCXX_HAVE_TLS
@@ -718,15 +718,17 @@ namespace std
/// call_once
template<typename _Callable, typename... _Args>
void
- call_once(once_flag& __once, _Callable __f, _Args&&... __args)
+ call_once(once_flag& __once, _Callable&& __f, _Args&&... __args)
{
#ifdef _GLIBCXX_HAVE_TLS
- auto __bound_functor = std::bind<void>(__f, __args...);
+ auto __bound_functor = std::bind<void>(std::forward<_Callable>(__f),
+ std::forward<_Args>(__args)...);
__once_callable = &__bound_functor;
__once_call = &__once_call_impl<decltype(__bound_functor)>;
#else
unique_lock<mutex> __functor_lock(__get_once_mutex());
- __once_functor = std::bind<void>(__f, __args...);
+ __once_functor = std::bind<void>(std::forward<_Callable>(__f),
+ std::forward<_Args>(__args)...);
__set_once_functor_lock_ptr(&__functor_lock);
#endif
OpenPOWER on IntegriCloud