summaryrefslogtreecommitdiff
path: root/test/std/thread/thread.mutex/thread.lock
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/thread/thread.mutex/thread.lock')
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp5
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/types.pass.cpp6
23 files changed, 78 insertions, 15 deletions
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
index 840af6788d04..81fc0d368f6a 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp
@@ -16,6 +16,7 @@
// lock_guard(Mutex&..., adopt_lock_t);
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <cassert>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
index 18193e000edc..1b4c9d4bfd5d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp
@@ -16,6 +16,7 @@
// lock_guard& operator=(lock_guard const&) = delete;
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
index 6dc37e970fb6..c7fd0e94b771 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp
@@ -16,6 +16,7 @@
// lock_guard(lock_guard const&) = delete;
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
index 866538a2834f..1eef7e268fb2 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp
@@ -16,6 +16,7 @@
// explicit lock_guard(Mutex&...);
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
index 4910d837cae3..8d83ddf98c6d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp
@@ -16,6 +16,7 @@
// explicit lock_guard(mutex_type& m);
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <cassert>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
index 3c134e0b8861..0ad16e2856fd 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-
// <mutex>
// template <class ...Mutex> class lock_guard;
@@ -17,5 +16,6 @@
// dialects, including C++03, even though it is forward declared using
// variadic templates.
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include "mutex.pass.cpp" // Use the existing non-variadic test
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
index 2b06742a673e..600399d9793e 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp
@@ -20,6 +20,7 @@
// ...
// };
+// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
#include <mutex>
#include <type_traits>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
index 12bef34cf87b..f9a537085c30 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// template <class Mutex> class shared_lock;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
index 84f868d6810b..839e12dba685 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
index 9359731486dd..9401cea2ed10 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// FLAKY_TEST.
+
// <shared_mutex>
// class shared_timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
index 5c3513c98e03..25d78ab19021 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -54,6 +53,7 @@ void f()
assert(lk.owns_lock() == true);
ns d = t1 - t0 - WaitTime;
assert(d < Tolerance); // within tolerance
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -63,8 +63,10 @@ void f()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -74,6 +76,7 @@ void f()
{
assert(e.code().value() == EPERM);
}
+#endif
}
int main()
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
index 01693c77ea39..947b1ad012ec 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -20,6 +19,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_called = false;
struct mutex
@@ -36,11 +37,11 @@ mutex m;
int main()
{
-
std::shared_lock<mutex> lk(m, std::defer_lock);
assert(lk.try_lock() == true);
assert(try_lock_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -50,11 +51,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock() == false);
assert(try_lock_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -64,4 +67,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
index 852a94eb65ec..5cb805412563 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -21,6 +20,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_for_called = false;
typedef std::chrono::milliseconds ms;
@@ -45,6 +46,7 @@ int main()
assert(lk.try_lock_for(ms(5)) == true);
assert(try_lock_for_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -54,11 +56,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_for(ms(5)) == false);
assert(try_lock_for_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -68,4 +72,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
index 31574afd7d8f..3ba4128d719c 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -21,6 +20,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_until_called = false;
struct mutex
@@ -45,6 +46,7 @@ int main()
assert(lk.try_lock_until(Clock::now()) == true);
assert(try_lock_until_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -54,11 +56,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_until(Clock::now()) == false);
assert(try_lock_until_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -68,4 +72,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
index 6a7385ed42a6..903b53ace0f2 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
@@ -20,6 +19,8 @@
#include <shared_mutex>
#include <cassert>
+#include "test_macros.h"
+
bool unlock_called = false;
struct mutex
@@ -36,6 +37,7 @@ int main()
lk.unlock();
assert(unlock_called == true);
assert(lk.owns_lock() == false);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -45,7 +47,9 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -55,4 +59,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
index 33e400b0da80..0939a5792644 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST.
+
// <mutex>
// class timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
index 2ead67097730..ceb29370182d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST.
+
// <mutex>
// class timed_mutex;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
index 6ce33761068f..cb5c55925eef 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -21,6 +20,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::mutex m;
typedef std::chrono::system_clock Clock;
@@ -38,6 +39,7 @@ void f()
assert(lk.owns_lock() == true);
ns d = t1 - t0 - ms(250);
assert(d < ms(25)); // within 25ms
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -47,8 +49,10 @@ void f()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.lock();
@@ -58,6 +62,7 @@ void f()
{
assert(e.code().value() == EPERM);
}
+#endif
}
int main()
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
index 27d0562de31f..709c56978af8 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -19,6 +18,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_called = false;
struct mutex
@@ -39,6 +40,7 @@ int main()
assert(lk.try_lock() == true);
assert(try_lock_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -48,11 +50,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock() == false);
assert(try_lock_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock();
@@ -62,4 +66,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
index 6f0a7219d2d8..6c981787d4b4 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -20,6 +19,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_for_called = false;
typedef std::chrono::milliseconds ms;
@@ -44,6 +45,7 @@ int main()
assert(lk.try_lock_for(ms(5)) == true);
assert(try_lock_for_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -53,11 +55,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_for(ms(5)) == false);
assert(try_lock_for_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_for(ms(5));
@@ -67,4 +71,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
index b7e87249b596..57231b207a72 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -20,6 +19,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool try_lock_until_called = false;
struct mutex
@@ -44,6 +45,7 @@ int main()
assert(lk.try_lock_until(Clock::now()) == true);
assert(try_lock_until_called == true);
assert(lk.owns_lock() == true);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -53,11 +55,13 @@ int main()
{
assert(e.code().value() == EDEADLK);
}
+#endif
lk.unlock();
assert(lk.try_lock_until(Clock::now()) == false);
assert(try_lock_until_called == false);
assert(lk.owns_lock() == false);
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.try_lock_until(Clock::now());
@@ -67,4 +71,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
index 62497c9ec45a..124ff551f947 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
//
-// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
@@ -19,6 +18,8 @@
#include <mutex>
#include <cassert>
+#include "test_macros.h"
+
bool unlock_called = false;
struct mutex
@@ -35,6 +36,7 @@ int main()
lk.unlock();
assert(unlock_called == true);
assert(lk.owns_lock() == false);
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -44,7 +46,9 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
lk.release();
+#ifndef TEST_HAS_NO_EXCEPTIONS
try
{
lk.unlock();
@@ -54,4 +58,5 @@ int main()
{
assert(e.code().value() == EPERM);
}
+#endif
}
diff --git a/test/std/thread/thread.mutex/thread.lock/types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/types.pass.cpp
index 64df0680b0b9..5baaee533a6a 100644
--- a/test/std/thread/thread.mutex/thread.lock/types.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/types.pass.cpp
@@ -28,7 +28,7 @@ int main()
typedef std::try_to_lock_t T2;
typedef std::adopt_lock_t T3;
- T1 t1 = std::defer_lock;
- T2 t2 = std::try_to_lock;
- T3 t3 = std::adopt_lock;
+ T1 t1 = std::defer_lock; ((void)t1);
+ T2 t2 = std::try_to_lock; ((void)t2);
+ T3 t3 = std::adopt_lock; ((void)t3);
}