summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/std/mutex
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-25 20:14:27 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-25 20:14:27 +0000
commit2094ad2fdac49c08bb16eceac1cb8edb5c10a294 (patch)
tree64216b4268ae49070675dbac1fb3358d53d219df /libstdc++-v3/include/std/mutex
parentf047dd27e7c115b46c20e69619df910179c76877 (diff)
downloadppe42-gcc-2094ad2fdac49c08bb16eceac1cb8edb5c10a294.tar.gz
ppe42-gcc-2094ad2fdac49c08bb16eceac1cb8edb5c10a294.zip
2009-04-25 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/std/mutex (__get_once_functor_lock, __get_once_mutex): Replace global lock object with local locks on global mutex. * src/mutex.cc: Likewise. * config/abi/pre/gnu.ver: Adjust. * testsuite/30_threads/call_once/call_once2.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146785 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/mutex')
-rw-r--r--libstdc++-v3/include/std/mutex14
1 files changed, 5 insertions, 9 deletions
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index f26acc02f4f..3a22aabcad1 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -728,9 +728,10 @@ namespace std
}
#else
extern function<void()> __once_functor;
+ extern unique_lock<mutex>* __once_functor_lock;
- extern unique_lock<mutex>&
- __get_once_functor_lock();
+ extern mutex&
+ __get_once_mutex();
#endif
extern "C" void __once_proxy();
@@ -745,18 +746,13 @@ namespace std
__once_callable = &__bound_functor;
__once_call = &__once_call_impl<decltype(__bound_functor)>;
#else
- unique_lock<mutex>& __functor_lock = __get_once_functor_lock();
- __functor_lock.lock();
+ unique_lock<mutex> __functor_lock(__get_once_mutex());
__once_functor = bind(__f, __args...);
+ __once_functor_lock = &__functor_lock;
#endif
int __e = __gthread_once(&(__once._M_once), &__once_proxy);
-#ifndef _GLIBCXX_HAVE_TLS
- if (__functor_lock)
- __functor_lock.unlock();
-#endif
-
if (__e)
__throw_system_error(__e);
}
OpenPOWER on IntegriCloud