aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2011-11-07 22:26:15 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2011-11-07 22:26:15 +0000
commit48d8dd06b0427394bbf678b283354fa27be8dce1 (patch)
treee5214d4cf5b63d66ee5b1c2526c78957454dc230
parentc5a0818e683e9bf93b3edfce46333ccac054b21f (diff)
downloadgcc-48d8dd06b0427394bbf678b283354fa27be8dce1.zip
gcc-48d8dd06b0427394bbf678b283354fa27be8dce1.tar.gz
gcc-48d8dd06b0427394bbf678b283354fa27be8dce1.tar.bz2
mutex (call_once): Store closure in __once_functor as bound function wrapper might not be copyable.
* include/std/mutex (call_once): Store closure in __once_functor as bound function wrapper might not be copyable. From-SVN: r181128
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/std/mutex3
2 files changed, 7 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b8c222b..1583ef0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-07 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/mutex (call_once): Store closure in __once_functor
+ as bound function wrapper might not be copyable.
+
2011-11-07 Andrew MacLeod <amacleod@redhat.com>
* include/bits/atomic_base.h (atomic_thread_fence): Revert.
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index bc2675b..69e26e6 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -810,8 +810,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__once_call = &__once_call_impl<decltype(__bound_functor)>;
#else
unique_lock<mutex> __functor_lock(__get_once_mutex());
- __once_functor = std::__bind_simple(std::forward<_Callable>(__f),
+ auto __callable = std::__bind_simple(std::forward<_Callable>(__f),
std::forward<_Args>(__args)...);
+ __once_functor = [&]() { __callable(); };
__set_once_functor_lock_ptr(&__functor_lock);
#endif