aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2013-06-09 23:54:07 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2013-06-10 00:54:07 +0100
commitbd24ec2de08152666d95813a156007efff294bad (patch)
treecbebc0c0bb8317e87a6ab55453980b226a4e1c0c /libstdc++-v3/testsuite
parent0d00888247bcfe39791153f9aa1fd8734f58bc74 (diff)
downloadgcc-bd24ec2de08152666d95813a156007efff294bad.zip
gcc-bd24ec2de08152666d95813a156007efff294bad.tar.gz
gcc-bd24ec2de08152666d95813a156007efff294bad.tar.bz2
mutex (call_once): Remove parentheses to fix error in c++1y and gnu++1y mode.
* include/std/mutex (call_once): Remove parentheses to fix error in c++1y and gnu++1y mode. * testsuite/30_threads/mutex/try_lock/2.cc: Call try_lock() in new thread to avoid undefined behaviour. From-SVN: r199875
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc
index bb3fcd4..f2a6723 100644
--- a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc
+++ b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc
@@ -24,6 +24,7 @@
#include <mutex>
+#include <thread>
#include <system_error>
#include <testsuite_hooks.h>
@@ -38,15 +39,18 @@ int main()
m.lock();
bool b;
- try
- {
- b = m.try_lock();
- VERIFY( !b );
- }
- catch (const std::system_error& e)
- {
- VERIFY( false );
- }
+ std::thread t([&] {
+ try
+ {
+ b = m.try_lock();
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ });
+ t.join();
+ VERIFY( !b );
m.unlock();
}