diff --git a/include/__mutex_base b/include/__mutex_base index 3bc0b5ba..d7c67c71 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -14,7 +14,35 @@ #include <__config> #include #include +#ifdef __MINGW32__ +typedef unsigned pthread_t; +typedef unsigned pthread_mutex_t; +typedef unsigned pthread_mutexattr_t; +typedef unsigned pthread_cond_t; +typedef unsigned pthread_key_t; +#define PTHREAD_MUTEX_INITIALIZER 0 +#define PTHREAD_COND_INITIALIZER 0 +#define PTHREAD_MUTEX_RECURSIVE 0 +#define pthread_mutex_init(a,b) (*(a) = 0, -1) +#define pthread_mutex_destroy(a) (-1) +#define pthread_mutex_lock(a) (-1) +#define pthread_mutex_trylock(a) (-1) +#define pthread_mutex_unlock(a) (-1) +#define pthread_mutexattr_settype(a,b) (*(a) = (b), -1) +#define pthread_mutexattr_init(a) (*(a) = 0, -1) +#define pthread_mutexattr_destroy(a) (-1) +#define pthread_self() (-1) +#define pthread_equal(a,b) (0) +#define pthread_getspecific(a) ((void*)0) +#define pthread_cond_destroy(a) (-1) +#define pthread_cond_signal(a) (-1) +#define pthread_cond_broadcast(a) (-1) +#define pthread_cond_wait(a,b) (-1) +#define pthread_cond_timedwait(a,b,c) (-1) +#define sched_yield() (-1) +#else #include +#endif #pragma GCC system_header diff --git a/include/thread b/include/thread index 8b3edb7f..37c14a1e 100644 --- a/include/thread +++ b/include/thread @@ -95,7 +95,15 @@ void sleep_for(const chrono::duration& rel_time); #include #include #include <__mutex_base> +#ifdef __MINGW32__ +#define pthread_key_delete(a) (-1) +#define pthread_join(a,b) (-1) +#define pthread_detach(a) (-1) +#define nanosleep(a,b) (-1) +#define pthread_key_create(a,b) (-1) +#else #include +#endif #pragma GCC system_header diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp index ca1dca32..9dd7710f 100644 --- a/src/condition_variable.cpp +++ b/src/condition_variable.cpp @@ -57,8 +57,10 @@ condition_variable::__do_timed_wait(unique_lock& lk, ts.tv_sec = static_cast(s.count()); ts.tv_nsec = static_cast((d - s).count()); int ec = pthread_cond_timedwait(&__cv_, lk.mutex()->native_handle(), &ts); +#ifndef __MINGW32__ if (ec != 0 && ec != ETIMEDOUT) __throw_system_error(ec, "condition_variable timed_wait failed"); +#endif } void diff --git a/src/thread.cpp b/src/thread.cpp index 4ccff327..616b83e1 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -12,7 +12,10 @@ #include "vector" #include "future" #include +#ifdef __MINGW32__ +#else #include +#endif _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/test/thread/futures/futures.async/async.fail.cpp b/test/thread/futures/futures.async/async.fail.cpp deleted file mode 100644 index 697eb089..00000000 --- a/test/thread/futures/futures.async/async.fail.cpp +++ /dev/null @@ -1,177 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// future::type> -// async(F&& f, Args&&... args); - -// template -// future::type> -// async(launch policy, F&& f, Args&&... args); - -#include -#include -#include - -typedef std::chrono::high_resolution_clock Clock; -typedef std::chrono::milliseconds ms; - -int f0() -{ - std::this_thread::sleep_for(ms(200)); - return 3; -} - -int i = 0; - -int& f1() -{ - std::this_thread::sleep_for(ms(200)); - return i; -} - -void f2() -{ - std::this_thread::sleep_for(ms(200)); -} - -std::unique_ptr f3(int i) -{ - std::this_thread::sleep_for(ms(200)); - return std::unique_ptr(new int(i)); -} - -std::unique_ptr f4(std::unique_ptr&& p) -{ - std::this_thread::sleep_for(ms(200)); - return std::move(p); -} - -int main() -{ - { - std::future f = std::async(f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::async, f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::any, f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::deferred, f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 > ms(100)); - } - - { - std::future f = std::async(f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::async, f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::any, f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::deferred, f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 > ms(100)); - } - - { - std::future f = std::async(f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::async, f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::any, f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future f = std::async(std::launch::deferred, f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 > ms(100)); - } - - { - std::future> f = std::async(f3, 3); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(*f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - - { - std::future> f = - std::async(f4, std::unique_ptr(new int(3))); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(*f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } -} diff --git a/test/thread/futures/futures.errors/default_error_condition.pass.cpp b/test/thread/futures/futures.errors/default_error_condition.pass.cpp deleted file mode 100644 index 38b11512..00000000 --- a/test/thread/futures/futures.errors/default_error_condition.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// const error_category& future_category(); - -// virtual error_condition default_error_condition(int ev) const; - -#include -#include - -int main() -{ - const std::error_category& e_cat = std::future_category(); - std::error_condition e_cond = e_cat.default_error_condition(std::errc::not_a_directory); - assert(e_cond.category() == e_cat); - assert(e_cond.value() == std::errc::not_a_directory); -} diff --git a/test/thread/futures/futures.errors/equivalent_error_code_int.pass.cpp b/test/thread/futures/futures.errors/equivalent_error_code_int.pass.cpp deleted file mode 100644 index 1f1cf407..00000000 --- a/test/thread/futures/futures.errors/equivalent_error_code_int.pass.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// const error_category& future_category(); - -// virtual bool equivalent(const error_code& code, int condition) const; - -#include -#include - -int main() -{ - const std::error_category& e_cat = std::future_category(); - assert(e_cat.equivalent(std::error_code(5, e_cat), 5)); - assert(!e_cat.equivalent(std::error_code(5, e_cat), 6)); -} diff --git a/test/thread/futures/futures.errors/equivalent_int_error_condition.pass.cpp b/test/thread/futures/futures.errors/equivalent_int_error_condition.pass.cpp deleted file mode 100644 index 06fdce1b..00000000 --- a/test/thread/futures/futures.errors/equivalent_int_error_condition.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// const error_category& future_category(); - -// virtual bool equivalent(int code, const error_condition& condition) const; - -#include -#include - -int main() -{ - const std::error_category& e_cat = std::future_category(); - std::error_condition e_cond = e_cat.default_error_condition(5); - assert(e_cat.equivalent(5, e_cond)); - assert(!e_cat.equivalent(6, e_cond)); -} diff --git a/test/thread/futures/futures.errors/future_category.pass.cpp b/test/thread/futures/futures.errors/future_category.pass.cpp deleted file mode 100644 index 515946c6..00000000 --- a/test/thread/futures/futures.errors/future_category.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// const error_category& future_category(); - -#include -#include -#include - -int main() -{ - const std::error_category& ec = std::future_category(); - assert(std::strcmp(ec.name(), "future") == 0); -} diff --git a/test/thread/futures/futures.errors/make_error_code.pass.cpp b/test/thread/futures/futures.errors/make_error_code.pass.cpp deleted file mode 100644 index f904c466..00000000 --- a/test/thread/futures/futures.errors/make_error_code.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class error_code - -// error_code make_error_code(future_errc e); - -#include -#include - -int main() -{ - { - std::error_code ec = make_error_code(std::future_errc::broken_promise); - assert(ec.value() == static_cast(std::future_errc::broken_promise)); - assert(ec.category() == std::future_category()); - } -} diff --git a/test/thread/futures/futures.errors/make_error_condition.pass.cpp b/test/thread/futures/futures.errors/make_error_condition.pass.cpp deleted file mode 100644 index fd0f1c58..00000000 --- a/test/thread/futures/futures.errors/make_error_condition.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class error_condition - -// error_condition make_error_condition(future_errc e); - -#include -#include - -int main() -{ - { - const std::error_condition ec1 = - std::make_error_condition(std::future_errc::future_already_retrieved); - assert(ec1.value() == - static_cast(std::future_errc::future_already_retrieved)); - assert(ec1.category() == std::future_category()); - } -} diff --git a/test/thread/futures/futures.future_error/code.pass.cpp b/test/thread/futures/futures.future_error/code.pass.cpp deleted file mode 100644 index fdbfa4ed..00000000 --- a/test/thread/futures/futures.future_error/code.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future_error - -// const error_code& code() const throw(); - -#include -#include - -int main() -{ - { - std::error_code ec = std::make_error_code(std::future_errc::broken_promise); - std::future_error f(ec); - assert(f.code() == ec); - } - { - std::error_code ec = std::make_error_code(std::future_errc::future_already_retrieved); - std::future_error f(ec); - assert(f.code() == ec); - } - { - std::error_code ec = std::make_error_code(std::future_errc::promise_already_satisfied); - std::future_error f(ec); - assert(f.code() == ec); - } - { - std::error_code ec = std::make_error_code(std::future_errc::no_state); - std::future_error f(ec); - assert(f.code() == ec); - } -} diff --git a/test/thread/futures/futures.future_error/types.pass.cpp b/test/thread/futures/futures.future_error/types.pass.cpp deleted file mode 100644 index af8e219b..00000000 --- a/test/thread/futures/futures.future_error/types.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future_error : public logic_error {...}; - -#include -#include - -int main() -{ - static_assert((std::is_convertible::value), ""); -} diff --git a/test/thread/futures/futures.future_error/what.pass.cpp b/test/thread/futures/futures.future_error/what.pass.cpp deleted file mode 100644 index 1c250a9f..00000000 --- a/test/thread/futures/futures.future_error/what.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future_error - -// const char* what() const throw(); - -#include -#include -#include - -int main() -{ - { - std::future_error f(std::make_error_code(std::future_errc::broken_promise)); - assert(std::strcmp(f.what(), "The associated promise has been destructed prior " - "to the associated state becoming ready.") == 0); - } - { - std::future_error f(std::make_error_code(std::future_errc::future_already_retrieved)); - assert(std::strcmp(f.what(), "The future has already been retrieved from " - "the promise or packaged_task.") == 0); - } - { - std::future_error f(std::make_error_code(std::future_errc::promise_already_satisfied)); - assert(std::strcmp(f.what(), "The state of the promise has already been set.") == 0); - } - { - std::future_error f(std::make_error_code(std::future_errc::no_state)); - assert(std::strcmp(f.what(), "Operation not permitted on an object without " - "an associated state.") == 0); - } -} diff --git a/test/thread/futures/futures.overview/future_errc.pass.cpp b/test/thread/futures/futures.overview/future_errc.pass.cpp deleted file mode 100644 index fe41aa7e..00000000 --- a/test/thread/futures/futures.overview/future_errc.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// enum class future_errc -// { -// broken_promise, -// future_already_retrieved, -// promise_already_satisfied, -// no_state -// }; - -#include - -int main() -{ - static_assert(std::future_errc::broken_promise == 0, ""); - static_assert(std::future_errc::future_already_retrieved == 1, ""); - static_assert(std::future_errc::promise_already_satisfied == 2, ""); - static_assert(std::future_errc::no_state == 3, ""); -} diff --git a/test/thread/futures/futures.overview/future_status.pass.cpp b/test/thread/futures/futures.overview/future_status.pass.cpp deleted file mode 100644 index 11fbe219..00000000 --- a/test/thread/futures/futures.overview/future_status.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// enum class future_status -// { -// ready, -// timeout, -// deferred -// }; - -#include - -int main() -{ - static_assert(std::future_status::ready == 0, ""); - static_assert(std::future_status::timeout == 1, ""); - static_assert(std::future_status::deferred == 2, ""); -} diff --git a/test/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp b/test/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp deleted file mode 100644 index 85b79932..00000000 --- a/test/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp +++ /dev/null @@ -1,19 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template <> struct is_error_code_enum : public true_type {}; - -#include - -int main() -{ - static_assert(std::is_error_code_enum::value, ""); -} diff --git a/test/thread/futures/futures.overview/launch.pass.cpp b/test/thread/futures/futures.overview/launch.pass.cpp deleted file mode 100644 index 63eebe9f..00000000 --- a/test/thread/futures/futures.overview/launch.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// enum class launch -// { -// async = 1, -// deferred = 2, -// any = async | deferred -// }; - -#include - -int main() -{ - static_assert(std::launch::any == std::launch::async | std::launch::deferred, ""); - static_assert(std::launch::async == 1, ""); - static_assert(std::launch::deferred == 2, ""); -} diff --git a/test/thread/futures/futures.promise/alloc_ctor.xfail.pass.cpp b/test/thread/futures/futures.promise/alloc_ctor.xfail.pass.cpp deleted file mode 100644 index dca399fc..00000000 --- a/test/thread/futures/futures.promise/alloc_ctor.xfail.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// template -// promise(allocator_arg_t, const Allocator& a); - -#include -#include - -#include "../test_allocator.h" - -int main() -{ - assert(test_alloc_base::count == 0); - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); -} diff --git a/test/thread/futures/futures.promise/copy_assign.fail.cpp b/test/thread/futures/futures.promise/copy_assign.fail.cpp deleted file mode 100644 index c0827812..00000000 --- a/test/thread/futures/futures.promise/copy_assign.fail.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// promise& operator=(const promise& rhs) = delete; - -#include -#include - -#include "../test_allocator.h" - -int main() -{ - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - p = p0; - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - p = p0; - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - p = p0; - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); -} diff --git a/test/thread/futures/futures.promise/copy_ctor.fail.cpp b/test/thread/futures/futures.promise/copy_ctor.fail.cpp deleted file mode 100644 index 36a3555a..00000000 --- a/test/thread/futures/futures.promise/copy_ctor.fail.cpp +++ /dev/null @@ -1,81 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// promise(const promise&) = delete; - -#include -#include - -#include "../test_allocator.h" - -int main() -{ - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); -} diff --git a/test/thread/futures/futures.promise/default.xfail.pass.cpp b/test/thread/futures/futures.promise/default.xfail.pass.cpp deleted file mode 100644 index 47aec02d..00000000 --- a/test/thread/futures/futures.promise/default.xfail.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// promise(); - -#include -#include - -int main() -{ - { - std::promise p; - std::future f = p.get_future(); - assert(f.valid()); - } - { - std::promise p; - std::future f = p.get_future(); - assert(f.valid()); - } - { - std::promise p; - std::future f = p.get_future(); - assert(f.valid()); - } -} diff --git a/test/thread/futures/futures.promise/dtor.xfail.pass.cpp b/test/thread/futures/futures.promise/dtor.xfail.pass.cpp deleted file mode 100644 index 34016057..00000000 --- a/test/thread/futures/futures.promise/dtor.xfail.pass.cpp +++ /dev/null @@ -1,106 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// ~promise(); - -#include -#include - -int main() -{ - { - typedef int T; - std::future f; - { - std::promise p; - f = p.get_future(); - p.set_value(3); - } - assert(f.get() == 3); - } - { - typedef int T; - std::future f; - { - std::promise p; - f = p.get_future(); - } - try - { - T i = f.get(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::broken_promise)); - } - } - - { - typedef int& T; - int i = 4; - std::future f; - { - std::promise p; - f = p.get_future(); - p.set_value(i); - } - assert(&f.get() == &i); - } - { - typedef int& T; - std::future f; - { - std::promise p; - f = p.get_future(); - } - try - { - T i = f.get(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::broken_promise)); - } - } - - { - typedef void T; - std::future f; - { - std::promise p; - f = p.get_future(); - p.set_value(); - } - f.get(); - assert(true); - } - { - typedef void T; - std::future f; - { - std::promise p; - f = p.get_future(); - } - try - { - f.get(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::broken_promise)); - } - } -} diff --git a/test/thread/futures/futures.promise/get_future.xfail.pass.cpp b/test/thread/futures/futures.promise/get_future.xfail.pass.cpp deleted file mode 100644 index e7e78c72..00000000 --- a/test/thread/futures/futures.promise/get_future.xfail.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// future get_future(); - -#include -#include - -int main() -{ - { - std::promise p; - std::future f = p.get_future(); - p.set_value(105.5); - assert(f.get() == 105.5); - } - { - std::promise p; - std::future f = p.get_future(); - try - { - f = p.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::future_already_retrieved)); - } - } - { - std::promise p; - std::promise p0 = std::move(p); - try - { - std::future f = p.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - } -} diff --git a/test/thread/futures/futures.promise/move_assign.xfail.pass.cpp b/test/thread/futures/futures.promise/move_assign.xfail.pass.cpp deleted file mode 100644 index c378495c..00000000 --- a/test/thread/futures/futures.promise/move_assign.xfail.pass.cpp +++ /dev/null @@ -1,89 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// promise& operator=(promise&& rhs); - -#include -#include - -#include "../test_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - p = std::move(p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - p = std::move(p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - p = std::move(p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.promise/move_ctor.xfail.pass.cpp b/test/thread/futures/futures.promise/move_ctor.xfail.pass.cpp deleted file mode 100644 index 4bd013a9..00000000 --- a/test/thread/futures/futures.promise/move_ctor.xfail.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// promise(promise&& rhs); - -#include -#include - -#include "../test_allocator.h" - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::move(p0)); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::move(p0)); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::move(p0)); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - try - { - f = p0.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.promise/set_exception.xfail.pass.cpp b/test/thread/futures/futures.promise/set_exception.xfail.pass.cpp deleted file mode 100644 index 13c9aa9c..00000000 --- a/test/thread/futures/futures.promise/set_exception.xfail.pass.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void set_exception(exception_ptr p); - -#include -#include - -int main() -{ - { - typedef int T; - std::promise p; - std::future f = p.get_future(); - p.set_exception(std::make_exception_ptr(3)); - try - { - f.get(); - assert(false); - } - catch (int i) - { - assert(i == 3); - } - try - { - p.set_exception(std::make_exception_ptr(3)); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied)); - } - } -} diff --git a/test/thread/futures/futures.promise/set_exception_at_thread_exit.xfail.pass.cpp b/test/thread/futures/futures.promise/set_exception_at_thread_exit.xfail.pass.cpp deleted file mode 100644 index 9bfb3066..00000000 --- a/test/thread/futures/futures.promise/set_exception_at_thread_exit.xfail.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_exception_at_thread_exit(exception_ptr p); - -#include -#include - -void func(std::promise& p) -{ - const int i = 5; - p.set_exception_at_thread_exit(std::make_exception_ptr(3)); -} - -int main() -{ - { - typedef int T; - std::promise p; - std::future f = p.get_future(); - std::thread(func, std::move(p)).detach(); - try - { - f.get(); - assert(false); - } - catch (int i) - { - assert(i == 3); - } - } -} diff --git a/test/thread/futures/futures.promise/set_lvalue.xfail.pass.cpp b/test/thread/futures/futures.promise/set_lvalue.xfail.pass.cpp deleted file mode 100644 index 4ee5fbbd..00000000 --- a/test/thread/futures/futures.promise/set_lvalue.xfail.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value(R& r); - -#include -#include - -int main() -{ - { - typedef int& T; - int i = 3; - std::promise p; - std::future f = p.get_future(); - p.set_value(i); - int& j = f.get(); - assert(j == 3); - ++i; - assert(j == 4); - try - { - p.set_value(i); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied)); - } - } -} diff --git a/test/thread/futures/futures.promise/set_lvalue_at_thread_exit.xfail.pass.cpp b/test/thread/futures/futures.promise/set_lvalue_at_thread_exit.xfail.pass.cpp deleted file mode 100644 index fc768e4c..00000000 --- a/test/thread/futures/futures.promise/set_lvalue_at_thread_exit.xfail.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value_at_thread_exit(R& r); - -#include -#include -#include - -int i = 0; - -void func(std::promise& p) -{ - p.set_value_at_thread_exit(i); - i = 4; -} - -int main() -{ - { - std::promise p; - std::future f = p.get_future(); - std::thread(func, std::move(p)).detach(); - assert(f.get() == 4); - } -} diff --git a/test/thread/futures/futures.promise/set_rvalue.xfail.pass.cpp b/test/thread/futures/futures.promise/set_rvalue.xfail.pass.cpp deleted file mode 100644 index 3cbacea6..00000000 --- a/test/thread/futures/futures.promise/set_rvalue.xfail.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value(R&& r); - -#include -#include -#include - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -struct A -{ - A() {} - A(const A&) = delete; - A(A&&) {throw 9;} -}; - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef std::unique_ptr T; - T i(new int(3)); - std::promise p; - std::future f = p.get_future(); - p.set_value(std::move(i)); - assert(*f.get() == 3); - try - { - p.set_value(std::move(i)); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied)); - } - } - { - typedef A T; - T i; - std::promise p; - std::future f = p.get_future(); - try - { - p.set_value(std::move(i)); - assert(false); - } - catch (int j) - { - assert(j == 9); - } - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.promise/set_rvalue_at_thread_exit.xfail.pass.cpp b/test/thread/futures/futures.promise/set_rvalue_at_thread_exit.xfail.pass.cpp deleted file mode 100644 index 742cb08b..00000000 --- a/test/thread/futures/futures.promise/set_rvalue_at_thread_exit.xfail.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value_at_thread_exit(R&& r); - -#include -#include -#include - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -void func(std::promise>& p) -{ - p.set_value_at_thread_exit(std::unique_ptr(new int(5))); -} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - std::promise> p; - std::future> f = p.get_future(); - std::thread(func, std::move(p)).detach(); - assert(*f.get() == 5); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.promise/set_value_at_thread_exit_const.xfail.pass.cpp b/test/thread/futures/futures.promise/set_value_at_thread_exit_const.xfail.pass.cpp deleted file mode 100644 index ca05260c..00000000 --- a/test/thread/futures/futures.promise/set_value_at_thread_exit_const.xfail.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value_at_thread_exit(const R& r); - -#include -#include - -void func(std::promise& p) -{ - const int i = 5; - p.set_value_at_thread_exit(i); -} - -int main() -{ - { - std::promise p; - std::future f = p.get_future(); - std::thread(func, std::move(p)).detach(); - assert(f.get() == 5); - } -} diff --git a/test/thread/futures/futures.promise/set_value_at_thread_exit_void.xfail.pass.cpp b/test/thread/futures/futures.promise/set_value_at_thread_exit_void.xfail.pass.cpp deleted file mode 100644 index 689f1bf6..00000000 --- a/test/thread/futures/futures.promise/set_value_at_thread_exit_void.xfail.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value_at_thread_exit(); - -#include -#include -#include - -int i = 0; - -void func(std::promise& p) -{ - p.set_value_at_thread_exit(); - i = 1; -} - -int main() -{ - { - std::promise p; - std::future f = p.get_future(); - std::thread(func, std::move(p)).detach(); - f.get(); - assert(i == 1); - } -} diff --git a/test/thread/futures/futures.promise/set_value_const.xfail.pass.cpp b/test/thread/futures/futures.promise/set_value_const.xfail.pass.cpp deleted file mode 100644 index 94a9f923..00000000 --- a/test/thread/futures/futures.promise/set_value_const.xfail.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value(const R& r); - -#include -#include - -struct A -{ - A() {} - A(const A&) {throw 10;} -}; - -int main() -{ - { - typedef int T; - T i = 3; - std::promise p; - std::future f = p.get_future(); - p.set_value(i); - ++i; - assert(f.get() == 3); - --i; - try - { - p.set_value(i); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied)); - } - } - { - typedef A T; - T i; - std::promise p; - std::future f = p.get_future(); - try - { - p.set_value(i); - assert(false); - } - catch (int j) - { - assert(j == 10); - } - } -} diff --git a/test/thread/futures/futures.promise/set_value_void.xfail.pass.cpp b/test/thread/futures/futures.promise/set_value_void.xfail.pass.cpp deleted file mode 100644 index c3b7e789..00000000 --- a/test/thread/futures/futures.promise/set_value_void.xfail.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void promise::set_value(); - -#include -#include - -int main() -{ - { - typedef void T; - std::promise p; - std::future f = p.get_future(); - p.set_value(); - f.get(); - try - { - p.set_value(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied)); - } - } -} diff --git a/test/thread/futures/futures.promise/swap.xfail.pass.cpp b/test/thread/futures/futures.promise/swap.xfail.pass.cpp deleted file mode 100644 index 5e292b06..00000000 --- a/test/thread/futures/futures.promise/swap.xfail.pass.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// void swap(promise& other); - -// template void swap(promise& x, promise& y); - -#include -#include - -#include "../test_allocator.h" - -int main() -{ - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - p.swap(p0); - assert(test_alloc_base::count == 2); - std::future f = p.get_future(); - assert(test_alloc_base::count == 2); - assert(f.valid()); - f = p0.get_future(); - assert(f.valid()); - assert(test_alloc_base::count == 2); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 2); - swap(p, p0); - assert(test_alloc_base::count == 2); - std::future f = p.get_future(); - assert(test_alloc_base::count == 2); - assert(f.valid()); - f = p0.get_future(); - assert(f.valid()); - assert(test_alloc_base::count == 2); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p; - assert(test_alloc_base::count == 1); - p.swap(p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - f = p0.get_future(); - assert(f.valid()); - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); - { - std::promise p0(std::allocator_arg, test_allocator()); - std::promise p; - assert(test_alloc_base::count == 1); - swap(p, p0); - assert(test_alloc_base::count == 1); - std::future f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - f = p0.get_future(); - assert(f.valid()); - assert(test_alloc_base::count == 1); - } - assert(test_alloc_base::count == 0); -} diff --git a/test/thread/futures/futures.promise/uses_allocator.pass.cpp b/test/thread/futures/futures.promise/uses_allocator.pass.cpp deleted file mode 100644 index 1f30682a..00000000 --- a/test/thread/futures/futures.promise/uses_allocator.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class promise - -// template -// struct uses_allocator, Alloc> -// : true_type { }; - -#include -#include "../test_allocator.h" - -int main() -{ - static_assert((std::uses_allocator, test_allocator >::value), ""); - static_assert((std::uses_allocator, test_allocator >::value), ""); - static_assert((std::uses_allocator, test_allocator >::value), ""); -} diff --git a/test/thread/futures/futures.shared_future/copy_assign.xfail.pass.cpp b/test/thread/futures/futures.shared_future/copy_assign.xfail.pass.cpp deleted file mode 100644 index e6b86d18..00000000 --- a/test/thread/futures/futures.shared_future/copy_assign.xfail.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// shared_future& operator=(const shared_future& rhs); - -#include -#include - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef int T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f; - f = f0; - assert(f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::shared_future f0; - std::shared_future f; - f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f; - f = f0; - assert(f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::shared_future f0; - std::shared_future f; - f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f; - f = f0; - assert(f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::shared_future f0; - std::shared_future f; - f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.shared_future/copy_ctor.xfail.pass.cpp b/test/thread/futures/futures.shared_future/copy_ctor.xfail.pass.cpp deleted file mode 100644 index 445c189b..00000000 --- a/test/thread/futures/futures.shared_future/copy_ctor.xfail.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// shared_future(const shared_future& rhs); - -#include -#include - -int main() -{ - { - typedef int T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f = f0; - assert(f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::shared_future f0; - std::shared_future f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f = f0; - assert(f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::shared_future f0; - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f = f0; - assert(f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::shared_future f0; - std::shared_future f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } -} diff --git a/test/thread/futures/futures.shared_future/ctor_future.xfail.pass.cpp b/test/thread/futures/futures.shared_future/ctor_future.xfail.pass.cpp deleted file mode 100644 index 207473e0..00000000 --- a/test/thread/futures/futures.shared_future/ctor_future.xfail.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// shared_future(future&& rhs); - -#include -#include - -int main() -{ - { - typedef int T; - std::promise p; - std::future f0 = p.get_future(); - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::future f0; - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::future f0 = p.get_future(); - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::future f0; - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::future f0 = p.get_future(); - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::future f0; - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } -} diff --git a/test/thread/futures/futures.shared_future/default.pass.cpp b/test/thread/futures/futures.shared_future/default.pass.cpp deleted file mode 100644 index dc056e8b..00000000 --- a/test/thread/futures/futures.shared_future/default.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// shared_future(); - -#include -#include - -int main() -{ - { - std::shared_future f; - assert(!f.valid()); - } - { - std::shared_future f; - assert(!f.valid()); - } - { - std::shared_future f; - assert(!f.valid()); - } -} diff --git a/test/thread/futures/futures.shared_future/dtor.xfail.pass.cpp b/test/thread/futures/futures.shared_future/dtor.xfail.pass.cpp deleted file mode 100644 index a06a313b..00000000 --- a/test/thread/futures/futures.shared_future/dtor.xfail.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// ~shared_future(); - -#include -#include - -#include "../test_allocator.h" - -int main() -{ - assert(test_alloc_base::count == 0); - { - typedef int T; - std::shared_future f; - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); - { - typedef int& T; - std::shared_future f; - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); - { - typedef void T; - std::shared_future f; - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); -} diff --git a/test/thread/futures/futures.shared_future/get.xfail.pass.cpp b/test/thread/futures/futures.shared_future/get.xfail.pass.cpp deleted file mode 100644 index 52806e85..00000000 --- a/test/thread/futures/futures.shared_future/get.xfail.pass.cpp +++ /dev/null @@ -1,143 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// const R& shared_future::get(); -// R& shared_future::get(); -// void shared_future::get(); - -#include -#include - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(3); -} - -void func2(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_exception(std::make_exception_ptr(3)); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - j = 5; - p.set_value(j); -} - -void func4(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_exception(std::make_exception_ptr(3.5)); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(); -} - -void func6(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_exception(std::make_exception_ptr('c')); -} - -int main() -{ - { - typedef int T; - { - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - assert(f.get() == 3); - assert(f.valid()); - } - { - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func2, std::move(p)).detach(); - try - { - assert(f.valid()); - assert(f.get() == 3); - assert(false); - } - catch (int i) - { - assert(i == 3); - } - assert(f.valid()); - } - } - { - typedef int& T; - { - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - assert(f.get() == 5); - assert(f.valid()); - } - { - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func4, std::move(p)).detach(); - try - { - assert(f.valid()); - assert(f.get() == 3); - assert(false); - } - catch (double i) - { - assert(i == 3.5); - } - assert(f.valid()); - } - } - { - typedef void T; - { - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - f.get(); - assert(f.valid()); - } - { - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func6, std::move(p)).detach(); - try - { - assert(f.valid()); - f.get(); - assert(false); - } - catch (char i) - { - assert(i == 'c'); - } - assert(f.valid()); - } - } -} diff --git a/test/thread/futures/futures.shared_future/move_assign.xfail.pass.cpp b/test/thread/futures/futures.shared_future/move_assign.xfail.pass.cpp deleted file mode 100644 index 36e0168d..00000000 --- a/test/thread/futures/futures.shared_future/move_assign.xfail.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// shared_future& operator=(shared_future&& rhs); - -#include -#include - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef int T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f; - f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::shared_future f0; - std::shared_future f; - f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f; - f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::shared_future f0; - std::shared_future f; - f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f; - f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::shared_future f0; - std::shared_future f; - f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.shared_future/move_ctor.xfail.pass.cpp b/test/thread/futures/futures.shared_future/move_ctor.xfail.pass.cpp deleted file mode 100644 index 35b82218..00000000 --- a/test/thread/futures/futures.shared_future/move_ctor.xfail.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// shared_future(shared_future&& rhs); - -#include -#include - -int main() -{ - { - typedef int T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::shared_future f0; - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::shared_future f0; - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::shared_future f0 = p.get_future(); - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::shared_future f0; - std::shared_future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } -} diff --git a/test/thread/futures/futures.shared_future/wait.xfail.pass.cpp b/test/thread/futures/futures.shared_future/wait.xfail.pass.cpp deleted file mode 100644 index 848cd254..00000000 --- a/test/thread/futures/futures.shared_future/wait.xfail.pass.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// void wait() const; - -#include -#include - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(3); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - j = 5; - p.set_value(j); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(); -} - -int main() -{ - typedef std::chrono::high_resolution_clock Clock; - typedef std::chrono::duration ms; - { - typedef int T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - f.wait(); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef int& T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - f.wait(); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef void T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - f.wait(); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } -} diff --git a/test/thread/futures/futures.shared_future/wait_for.xfail.pass.cpp b/test/thread/futures/futures.shared_future/wait_for.xfail.pass.cpp deleted file mode 100644 index 43b74a30..00000000 --- a/test/thread/futures/futures.shared_future/wait_for.xfail.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// template -// future_status -// wait_for(const chrono::duration& rel_time) const; - -#include -#include - -typedef std::chrono::milliseconds ms; - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(3); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - j = 5; - p.set_value(j); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(); -} - -int main() -{ - typedef std::chrono::high_resolution_clock Clock; - { - typedef int T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef int& T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef void T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } -} diff --git a/test/thread/futures/futures.shared_future/wait_until.xfail.pass.cpp b/test/thread/futures/futures.shared_future/wait_until.xfail.pass.cpp deleted file mode 100644 index 1cd091d4..00000000 --- a/test/thread/futures/futures.shared_future/wait_until.xfail.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class shared_future - -// template -// future_status -// wait_until(const chrono::time_point& abs_time) const; - -#include -#include - -typedef std::chrono::milliseconds ms; - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(3); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - j = 5; - p.set_value(j); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(); -} - -int main() -{ - typedef std::chrono::high_resolution_clock Clock; - { - typedef int T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef int& T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef void T; - std::promise p; - std::shared_future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } -} diff --git a/test/thread/futures/futures.state/nothing_to_do.pass.cpp b/test/thread/futures/futures.state/nothing_to_do.pass.cpp deleted file mode 100644 index 9a59227a..00000000 --- a/test/thread/futures/futures.state/nothing_to_do.pass.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp b/test/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp deleted file mode 100644 index 70ea0ad3..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// packaged_task& operator=(packaged_task&) = delete; - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int main() -{ - { - std::packaged_task p0(A(5)); - std::packaged_task p; - p = p0; - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p0; - std::packaged_task p; - p = p0; - assert(!p0.valid()); - assert(!p.valid()); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/assign_move.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/assign_move.xfail.pass.cpp deleted file mode 100644 index a0f711aa..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/assign_move.xfail.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// packaged_task& operator=(packaged_task&& other); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int main() -{ - { - std::packaged_task p0(A(5)); - std::packaged_task p; - p = std::move(p0); - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p0; - std::packaged_task p; - p = std::move(p0); - assert(!p0.valid()); - assert(!p.valid()); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp deleted file mode 100644 index 9884c49a..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// packaged_task(packaged_task&) = delete; - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int main() -{ - { - std::packaged_task p0(A(5)); - std::packaged_task p(p0); - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p0; - std::packaged_task p(p0); - assert(!p0.valid()); - assert(!p.valid()); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp deleted file mode 100644 index f53b26e2..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// packaged_task(); - -#include -#include - -struct A {}; - -int main() -{ - std::packaged_task p; - assert(!p.valid()); -} diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_func.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_func.xfail.pass.cpp deleted file mode 100644 index 8ae59216..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/ctor_func.xfail.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// template -// explicit packaged_task(F&& f); - -#include -#include - -class A -{ - long data_; - -public: - static int n_moves; - static int n_copies; - - explicit A(long i) : data_(i) {} - A(A&& a) : data_(a.data_) {++n_moves; a.data_ = -1;} - A(const A& a) : data_(a.data_) {++n_copies;} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int A::n_moves = 0; -int A::n_copies = 0; - -int main() -{ - { - std::packaged_task p(A(5)); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - assert(A::n_copies == 0); - assert(A::n_moves > 0); - } - A::n_copies == 0; - A::n_copies = 0; - { - A a(5); - std::packaged_task p(a); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - assert(A::n_copies > 0); - assert(A::n_moves > 0); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.xfail.pass.cpp deleted file mode 100644 index 63042e8c..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.xfail.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// template -// explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f); - -#include -#include - -#include "../../test_allocator.h" - -class A -{ - long data_; - -public: - static int n_moves; - static int n_copies; - - explicit A(long i) : data_(i) {} - A(A&& a) : data_(a.data_) {++n_moves; a.data_ = -1;} - A(const A& a) : data_(a.data_) {++n_copies;} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int A::n_moves = 0; -int A::n_copies = 0; - -int main() -{ - { - std::packaged_task p(std::allocator_arg, - test_allocator(), A(5)); - assert(test_alloc_base::count > 0); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - assert(A::n_copies == 0); - assert(A::n_moves > 0); - } - assert(test_alloc_base::count == 0); - A::n_copies == 0; - A::n_copies = 0; - { - A a(5); - std::packaged_task p(std::allocator_arg, - test_allocator(), a); - assert(test_alloc_base::count > 0); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - assert(A::n_copies > 0); - assert(A::n_moves > 0); - } - assert(test_alloc_base::count == 0); -} diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_move.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_move.xfail.pass.cpp deleted file mode 100644 index c668a678..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/ctor_move.xfail.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// packaged_task(packaged_task&& other); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int main() -{ - { - std::packaged_task p0(A(5)); - std::packaged_task p = std::move(p0); - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p0; - std::packaged_task p = std::move(p0); - assert(!p0.valid()); - assert(!p.valid()); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/dtor.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/dtor.xfail.pass.cpp deleted file mode 100644 index f9052907..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/dtor.xfail.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// ~packaged_task(); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -void func(std::packaged_task& p) -{ -} - -void func2(std::packaged_task& p) -{ - p(3, 'a'); -} - -int main() -{ - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread(func, std::move(p)).detach(); - try - { - double i = f.get(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::broken_promise)); - } - } - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread(func2, std::move(p)).detach(); - assert(f.get() == 105.0); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/get_future.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/get_future.xfail.pass.cpp deleted file mode 100644 index d6efbf13..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/get_future.xfail.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// future get_future(); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int main() -{ - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - try - { - f = p.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::future_already_retrieved)); - } - } - { - std::packaged_task p; - try - { - std::future f = p.get_future(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.xfail.pass.cpp deleted file mode 100644 index 992d1228..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.xfail.pass.cpp +++ /dev/null @@ -1,104 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// void make_ready_at_thread_exit(ArgTypes... args); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const - { - if (j == 'z') - throw A(6); - return data_ + i + j; - } -}; - -void func0(std::packaged_task& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.make_ready_at_thread_exit(3, 'a'); -} - -void func1(std::packaged_task& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.make_ready_at_thread_exit(3, 'z'); -} - -void func2(std::packaged_task& p) -{ - p.make_ready_at_thread_exit(3, 'a'); - try - { - p.make_ready_at_thread_exit(3, 'c'); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied)); - } -} - -void func3(std::packaged_task& p) -{ - try - { - p.make_ready_at_thread_exit(3, 'a'); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } -} - -int main() -{ - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread(func0, std::move(p)).detach(); - assert(f.get() == 105.0); - } - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - try - { - f.get(); - assert(false); - } - catch (const A& e) - { - assert(e(3, 'a') == 106); - } - } - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread(func2, std::move(p)).detach(); - assert(f.get() == 105.0); - } - { - std::packaged_task p; - std::thread t(func3, std::move(p)); - t.join(); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/operator.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/operator.xfail.pass.cpp deleted file mode 100644 index b99c8aa0..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/operator.xfail.pass.cpp +++ /dev/null @@ -1,105 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// void operator()(ArgTypes... args); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const - { - if (j == 'z') - throw A(6); - return data_ + i + j; - } -}; - -void func0(std::packaged_task& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p(3, 'a'); -} - -void func1(std::packaged_task& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p(3, 'z'); -} - -void func2(std::packaged_task& p) -{ - p(3, 'a'); - try - { - p(3, 'c'); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied)); - } -} - -void func3(std::packaged_task& p) -{ - try - { - p(3, 'a'); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } -} - -int main() -{ - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread(func0, std::move(p)).detach(); - assert(f.get() == 105.0); - } - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - try - { - f.get(); - assert(false); - } - catch (const A& e) - { - assert(e(3, 'a') == 106); - } - } - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - std::thread t(func2, std::move(p)); - assert(f.get() == 105.0); - t.join(); - } - { - std::packaged_task p; - std::thread t(func3, std::move(p)); - t.join(); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/reset.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/reset.xfail.pass.cpp deleted file mode 100644 index 3ca3d147..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/reset.xfail.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// void reset(); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const - { - if (j == 'z') - throw A(6); - return data_ + i + j; - } -}; - -int main() -{ - { - std::packaged_task p(A(5)); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - p.reset(); - p(4, 'a'); - f = p.get_future(); - assert(f.get() == 106.0); - } - { - std::packaged_task p; - try - { - p.reset(); - assert(false); - } - catch (const std::future_error& e) - { - assert(e.code() == make_error_code(std::future_errc::no_state)); - } - } -} diff --git a/test/thread/futures/futures.tas/futures.task.members/swap.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/swap.xfail.pass.cpp deleted file mode 100644 index 9f549aa3..00000000 --- a/test/thread/futures/futures.tas/futures.task.members/swap.xfail.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// void swap(packaged_task& other); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int main() -{ - { - std::packaged_task p0(A(5)); - std::packaged_task p; - p.swap(p0); - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p0; - std::packaged_task p; - p.swap(p0); - assert(!p0.valid()); - assert(!p.valid()); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.nonmembers/swap.xfail.pass.cpp b/test/thread/futures/futures.tas/futures.task.nonmembers/swap.xfail.pass.cpp deleted file mode 100644 index ef99f615..00000000 --- a/test/thread/futures/futures.tas/futures.task.nonmembers/swap.xfail.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// template -// void -// swap(packaged_task& x, packaged_task& y); - -#include -#include - -class A -{ - long data_; - -public: - explicit A(long i) : data_(i) {} - - long operator()(long i, long j) const {return data_ + i + j;} -}; - -int main() -{ - { - std::packaged_task p0(A(5)); - std::packaged_task p; - swap(p, p0); - assert(!p0.valid()); - assert(p.valid()); - std::future f = p.get_future(); - p(3, 'a'); - assert(f.get() == 105.0); - } - { - std::packaged_task p0; - std::packaged_task p; - swap(p, p0); - assert(!p0.valid()); - assert(!p.valid()); - } -} diff --git a/test/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp b/test/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp deleted file mode 100644 index 130390fa..00000000 --- a/test/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class packaged_task - -// template -// struct uses_allocator, Alloc> -// : true_type { }; - -#include -#include "../../test_allocator.h" - -int main() -{ - static_assert((std::uses_allocator, test_allocator >::value), ""); -} diff --git a/test/thread/futures/futures.tas/types.pass.cpp b/test/thread/futures/futures.tas/types.pass.cpp deleted file mode 100644 index c66f359a..00000000 --- a/test/thread/futures/futures.tas/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// class packaged_task -// { -// public: -// typedef R result_type; - -#include -#include - -struct A {}; - -int main() -{ - static_assert((std::is_same::result_type, A>::value), ""); -} diff --git a/test/thread/futures/futures.unique_future/copy_assign.fail.cpp b/test/thread/futures/futures.unique_future/copy_assign.fail.cpp deleted file mode 100644 index ebdcbf98..00000000 --- a/test/thread/futures/futures.unique_future/copy_assign.fail.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// future& operator=(const future&) = delete; - -#include -#include - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef int T; - std::promise p; - std::future f0 = p.get_future(); - std::future f; - f = f0; - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::future f0; - std::future f; - f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::future f0 = p.get_future(); - std::future f; - f = f0; - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::future f0; - std::future f; - f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::future f0 = p.get_future(); - std::future f; - f = f0; - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::future f0; - std::future f; - f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.unique_future/copy_ctor.fail.cpp b/test/thread/futures/futures.unique_future/copy_ctor.fail.cpp deleted file mode 100644 index 8d43294e..00000000 --- a/test/thread/futures/futures.unique_future/copy_ctor.fail.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// future(const future&) = delete; - -#include -#include - -int main() -{ - { - typedef int T; - std::promise p; - std::future f0 = p.get_future(); - std::future f = f0; - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::future f0; - std::future f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::future f0 = p.get_future(); - std::future f = f0; - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::future f0; - std::future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::future f0 = p.get_future(); - std::future f = f0; - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::future f0; - std::future f = f0; - assert(!f0.valid()); - assert(!f.valid()); - } -} diff --git a/test/thread/futures/futures.unique_future/default.pass.cpp b/test/thread/futures/futures.unique_future/default.pass.cpp deleted file mode 100644 index 915f118f..00000000 --- a/test/thread/futures/futures.unique_future/default.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// future(); - -#include -#include - -int main() -{ - { - std::future f; - assert(!f.valid()); - } - { - std::future f; - assert(!f.valid()); - } - { - std::future f; - assert(!f.valid()); - } -} diff --git a/test/thread/futures/futures.unique_future/dtor.xfail.pass.cpp b/test/thread/futures/futures.unique_future/dtor.xfail.pass.cpp deleted file mode 100644 index 1bc141bc..00000000 --- a/test/thread/futures/futures.unique_future/dtor.xfail.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// ~future(); - -#include -#include - -#include "../test_allocator.h" - -int main() -{ - assert(test_alloc_base::count == 0); - { - typedef int T; - std::future f; - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); - { - typedef int& T; - std::future f; - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); - { - typedef void T; - std::future f; - { - std::promise p(std::allocator_arg, test_allocator()); - assert(test_alloc_base::count == 1); - f = p.get_future(); - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 1); - assert(f.valid()); - } - assert(test_alloc_base::count == 0); -} diff --git a/test/thread/futures/futures.unique_future/get.xfail.pass.cpp b/test/thread/futures/futures.unique_future/get.xfail.pass.cpp deleted file mode 100644 index ae936b09..00000000 --- a/test/thread/futures/futures.unique_future/get.xfail.pass.cpp +++ /dev/null @@ -1,143 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// R future::get(); -// R& future::get(); -// void future::get(); - -#include -#include - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(3); -} - -void func2(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_exception(std::make_exception_ptr(3)); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - j = 5; - p.set_value(j); -} - -void func4(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_exception(std::make_exception_ptr(3.5)); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(); -} - -void func6(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_exception(std::make_exception_ptr('c')); -} - -int main() -{ - { - typedef int T; - { - std::promise p; - std::future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - assert(f.get() == 3); - assert(!f.valid()); - } - { - std::promise p; - std::future f = p.get_future(); - std::thread(func2, std::move(p)).detach(); - try - { - assert(f.valid()); - assert(f.get() == 3); - assert(false); - } - catch (int i) - { - assert(i == 3); - } - assert(!f.valid()); - } - } - { - typedef int& T; - { - std::promise p; - std::future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - assert(f.get() == 5); - assert(!f.valid()); - } - { - std::promise p; - std::future f = p.get_future(); - std::thread(func4, std::move(p)).detach(); - try - { - assert(f.valid()); - assert(f.get() == 3); - assert(false); - } - catch (double i) - { - assert(i == 3.5); - } - assert(!f.valid()); - } - } - { - typedef void T; - { - std::promise p; - std::future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - f.get(); - assert(!f.valid()); - } - { - std::promise p; - std::future f = p.get_future(); - std::thread(func6, std::move(p)).detach(); - try - { - assert(f.valid()); - f.get(); - assert(false); - } - catch (char i) - { - assert(i == 'c'); - } - assert(!f.valid()); - } - } -} diff --git a/test/thread/futures/futures.unique_future/move_assign.xfail.pass.cpp b/test/thread/futures/futures.unique_future/move_assign.xfail.pass.cpp deleted file mode 100644 index 79dcd7d1..00000000 --- a/test/thread/futures/futures.unique_future/move_assign.xfail.pass.cpp +++ /dev/null @@ -1,74 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// future& operator=(future&& rhs); - -#include -#include - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef int T; - std::promise p; - std::future f0 = p.get_future(); - std::future f; - f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::future f0; - std::future f; - f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::future f0 = p.get_future(); - std::future f; - f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::future f0; - std::future f; - f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::future f0 = p.get_future(); - std::future f; - f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::future f0; - std::future f; - f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.unique_future/move_ctor.xfail.pass.cpp b/test/thread/futures/futures.unique_future/move_ctor.xfail.pass.cpp deleted file mode 100644 index af23e4d9..00000000 --- a/test/thread/futures/futures.unique_future/move_ctor.xfail.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// future(future&& rhs); - -#include -#include - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - typedef int T; - std::promise p; - std::future f0 = p.get_future(); - std::future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::future f0; - std::future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::future f0 = p.get_future(); - std::future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::future f0; - std::future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::future f0 = p.get_future(); - std::future f = std::move(f0); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::future f0; - std::future f = std::move(f0); - assert(!f0.valid()); - assert(!f.valid()); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/futures/futures.unique_future/share.xfail.pass.cpp b/test/thread/futures/futures.unique_future/share.xfail.pass.cpp deleted file mode 100644 index a19ce2e3..00000000 --- a/test/thread/futures/futures.unique_future/share.xfail.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// shared_future share() &&; - -#include -#include - -int main() -{ - { - typedef int T; - std::promise p; - std::future f0 = p.get_future(); - std::shared_future f = std::move(f0.share()); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int T; - std::future f0; - std::shared_future f = std::move(f0.share()); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef int& T; - std::promise p; - std::future f0 = p.get_future(); - std::shared_future f = std::move(f0.share()); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef int& T; - std::future f0; - std::shared_future f = std::move(f0.share()); - assert(!f0.valid()); - assert(!f.valid()); - } - { - typedef void T; - std::promise p; - std::future f0 = p.get_future(); - std::shared_future f = std::move(f0.share()); - assert(!f0.valid()); - assert(f.valid()); - } - { - typedef void T; - std::future f0; - std::shared_future f = std::move(f0.share()); - assert(!f0.valid()); - assert(!f.valid()); - } -} diff --git a/test/thread/futures/futures.unique_future/wait.xfail.pass.cpp b/test/thread/futures/futures.unique_future/wait.xfail.pass.cpp deleted file mode 100644 index 19a61c9f..00000000 --- a/test/thread/futures/futures.unique_future/wait.xfail.pass.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// void wait() const; - -#include -#include - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(3); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - j = 5; - p.set_value(j); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - p.set_value(); -} - -int main() -{ - typedef std::chrono::high_resolution_clock Clock; - typedef std::chrono::duration ms; - { - typedef int T; - std::promise p; - std::future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - f.wait(); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef int& T; - std::promise p; - std::future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - f.wait(); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef void T; - std::promise p; - std::future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - f.wait(); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } -} diff --git a/test/thread/futures/futures.unique_future/wait_for.xfail.pass.cpp b/test/thread/futures/futures.unique_future/wait_for.xfail.pass.cpp deleted file mode 100644 index dd5d0a9d..00000000 --- a/test/thread/futures/futures.unique_future/wait_for.xfail.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// template -// future_status -// wait_for(const chrono::duration& rel_time) const; - -#include -#include - -typedef std::chrono::milliseconds ms; - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(3); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - j = 5; - p.set_value(j); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(); -} - -int main() -{ - typedef std::chrono::high_resolution_clock Clock; - { - typedef int T; - std::promise p; - std::future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef int& T; - std::promise p; - std::future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef void T; - std::promise p; - std::future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_for(ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } -} diff --git a/test/thread/futures/futures.unique_future/wait_until.xfail.pass.cpp b/test/thread/futures/futures.unique_future/wait_until.xfail.pass.cpp deleted file mode 100644 index 02057156..00000000 --- a/test/thread/futures/futures.unique_future/wait_until.xfail.pass.cpp +++ /dev/null @@ -1,95 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class future - -// template -// future_status -// wait_until(const chrono::time_point& abs_time) const; - -#include -#include - -typedef std::chrono::milliseconds ms; - -void func1(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(3); -} - -int j = 0; - -void func3(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - j = 5; - p.set_value(j); -} - -void func5(std::promise& p) -{ - std::this_thread::sleep_for(ms(500)); - p.set_value(); -} - -int main() -{ - typedef std::chrono::high_resolution_clock Clock; - { - typedef int T; - std::promise p; - std::future f = p.get_future(); - std::thread(func1, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef int& T; - std::promise p; - std::future f = p.get_future(); - std::thread(func3, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } - { - typedef void T; - std::promise p; - std::future f = p.get_future(); - std::thread(func5, std::move(p)).detach(); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::timeout); - assert(f.valid()); - assert(f.wait_until(Clock::now() + ms(300)) == std::future_status::ready); - assert(f.valid()); - Clock::time_point t0 = Clock::now(); - f.wait(); - Clock::time_point t1 = Clock::now(); - assert(f.valid()); - assert(t1-t0 < ms(5)); - } -} diff --git a/test/thread/futures/test_allocator.h b/test/thread/futures/test_allocator.h deleted file mode 100644 index 7644bc7c..00000000 --- a/test/thread/futures/test_allocator.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef TEST_ALLOCATOR_H -#define TEST_ALLOCATOR_H - -#include -#include -#include -#include -#include - -class test_alloc_base -{ -public: - static int count; -public: - static int throw_after; -}; - -int test_alloc_base::count = 0; -int test_alloc_base::throw_after = INT_MAX; - -template -class test_allocator - : public test_alloc_base -{ - int data_; - - template friend class test_allocator; -public: - - typedef unsigned size_type; - typedef int difference_type; - typedef T value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef typename std::add_lvalue_reference::type reference; - typedef typename std::add_lvalue_reference::type const_reference; - - template struct rebind {typedef test_allocator other;}; - - test_allocator() throw() : data_(-1) {} - explicit test_allocator(int i) throw() : data_(i) {} - test_allocator(const test_allocator& a) throw() - : data_(a.data_) {} - template test_allocator(const test_allocator& a) throw() - : data_(a.data_) {} - ~test_allocator() throw() {data_ = 0;} - pointer address(reference x) const {return &x;} - const_pointer address(const_reference x) const {return &x;} - pointer allocate(size_type n, const void* = 0) - { - if (count >= throw_after) - throw std::bad_alloc(); - ++count; - return (pointer)std::malloc(n * sizeof(T)); - } - void deallocate(pointer p, size_type n) - {--count; std::free(p);} - size_type max_size() const throw() - {return UINT_MAX / sizeof(T);} - void construct(pointer p, const T& val) - {::new(p) T(val);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void construct(pointer p, T&& val) - {::new(p) T(std::move(val));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - void destroy(pointer p) {p->~T();} - - friend bool operator==(const test_allocator& x, const test_allocator& y) - {return x.data_ == y.data_;} - friend bool operator!=(const test_allocator& x, const test_allocator& y) - {return !(x == y);} -}; - -template <> -class test_allocator - : public test_alloc_base -{ - int data_; - - template friend class test_allocator; -public: - - typedef unsigned size_type; - typedef int difference_type; - typedef void value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - - template struct rebind {typedef test_allocator other;}; - - test_allocator() throw() : data_(-1) {} - explicit test_allocator(int i) throw() : data_(i) {} - test_allocator(const test_allocator& a) throw() - : data_(a.data_) {} - template test_allocator(const test_allocator& a) throw() - : data_(a.data_) {} - ~test_allocator() throw() {data_ = 0;} - - friend bool operator==(const test_allocator& x, const test_allocator& y) - {return x.data_ == y.data_;} - friend bool operator!=(const test_allocator& x, const test_allocator& y) - {return !(x == y);} -}; - -template -class other_allocator -{ - int data_; - - template friend class other_allocator; - -public: - typedef T value_type; - - other_allocator() : data_(-1) {} - explicit other_allocator(int i) : data_(i) {} - template other_allocator(const other_allocator& a) - : data_(a.data_) {} - T* allocate(std::size_t n) - {return (T*)std::malloc(n * sizeof(T));} - void deallocate(T* p, std::size_t n) - {std::free(p);} - - other_allocator select_on_container_copy_construction() const - {return other_allocator(-2);} - - friend bool operator==(const other_allocator& x, const other_allocator& y) - {return x.data_ == y.data_;} - friend bool operator!=(const other_allocator& x, const other_allocator& y) - {return !(x == y);} - - typedef std::true_type propagate_on_container_copy_assignment; - typedef std::true_type propagate_on_container_move_assignment; - typedef std::true_type propagate_on_container_swap; - -#ifdef _LIBCPP_HAS_NO_ADVANCED_SFINAE - std::size_t max_size() const - {return UINT_MAX / sizeof(T);} -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE - -}; - -#endif // TEST_ALLOCATOR_H diff --git a/test/thread/futures/version.pass.cpp b/test/thread/futures/version.pass.cpp deleted file mode 100644 index 5ac4e0fd..00000000 --- a/test/thread/futures/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/thread/macro.pass.cpp b/test/thread/macro.pass.cpp deleted file mode 100644 index 243640d0..00000000 --- a/test/thread/macro.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// #define __STDCPP_THREADS__ __cplusplus - -#include - -int main() -{ -#ifndef __STDCPP_THREADS__ -#error __STDCPP_THREADS__ is not defined -#endif -} diff --git a/test/thread/thread.condition/cv_status.pass.cpp b/test/thread/thread.condition/cv_status.pass.cpp deleted file mode 100644 index d8976576..00000000 --- a/test/thread/thread.condition/cv_status.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// enum class cv_status { no_timeout, timeout }; - -#include -#include - -int main() -{ - assert(std::cv_status::no_timeout == 0); - assert(std::cv_status::timeout == 1); -} diff --git a/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp b/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp deleted file mode 100644 index e4f193a3..00000000 --- a/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void -// notify_all_at_thread_exit(condition_variable& cond, unique_lock lk); - -#include -#include -#include -#include -#include - -std::condition_variable cv; -std::mutex mut; - -typedef std::chrono::milliseconds ms; -typedef std::chrono::high_resolution_clock Clock; - -void func() -{ - std::unique_lock lk(mut); - std::notify_all_at_thread_exit(cv, std::move(lk)); - std::this_thread::sleep_for(ms(300)); -} - -int main() -{ - std::unique_lock lk(mut); - std::thread(func).detach(); - Clock::time_point t0 = Clock::now(); - cv.wait(lk); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 > ms(250)); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/assign.fail.cpp b/test/thread/thread.condition/thread.condition.condvar/assign.fail.cpp deleted file mode 100644 index e88550c5..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/assign.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// condition_variable& operator=(const condition_variable&) = delete; - -#include -#include - -int main() -{ - std::condition_variable cv0; - std::condition_variable cv1; - cv1 = cv0; -} diff --git a/test/thread/thread.condition/thread.condition.condvar/copy.fail.cpp b/test/thread/thread.condition/thread.condition.condvar/copy.fail.cpp deleted file mode 100644 index 24d6ee0e..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/copy.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// condition_variable(const condition_variable&) = delete; - -#include -#include - -int main() -{ - std::condition_variable cv0; - std::condition_variable cv1(cv0); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp deleted file mode 100644 index a9124131..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// condition_variable(); - -#include -#include - -int main() -{ - std::condition_variable cv; -} diff --git a/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp deleted file mode 100644 index 9828fbb2..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// ~condition_variable(); - -#include -#include -#include -#include - -std::condition_variable* cv; -std::mutex m; -typedef std::unique_lock Lock; - -bool f_ready = false; -bool g_ready = false; - -void f() -{ - Lock lk(m); - f_ready = true; - cv->notify_one(); - delete cv; -} - -void g() -{ - Lock lk(m); - g_ready = true; - cv->notify_one(); - while (!f_ready) - cv->wait(lk); -} - -int main() -{ - cv = new std::condition_variable; - std::thread th2(g); - Lock lk(m); - while (!g_ready) - cv->wait(lk); - lk.unlock(); - std::thread th1(f); - th1.join(); - th2.join(); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp deleted file mode 100644 index 52b73c08..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// typedef pthread_cond_t* native_handle_type; -// native_handle_type native_handle(); - -#include -#include - -int main() -{ - static_assert((std::is_same::value), ""); - std::condition_variable cv; - std::condition_variable::native_handle_type h = cv.native_handle(); - assert(h != nullptr); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp deleted file mode 100644 index 0b50e26b..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// void notify_all(); - -#include -#include -#include -#include - -std::condition_variable cv; -std::mutex mut; - -int test0 = 0; -int test1 = 0; -int test2 = 0; - -void f1() -{ - std::unique_lock lk(mut); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 == 1); - test1 = 2; -} - -void f2() -{ - std::unique_lock lk(mut); - assert(test2 == 0); - while (test2 == 0) - cv.wait(lk); - assert(test2 == 1); - test2 = 2; -} - -int main() -{ - std::thread t1(f1); - std::thread t2(f2); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - { - std::unique_locklk(mut); - test1 = 1; - test2 = 1; - } - cv.notify_all(); - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - std::unique_locklk(mut); - } - t1.join(); - t2.join(); - assert(test1 == 2); - assert(test2 == 2); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp deleted file mode 100644 index c1125856..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// void notify_one(); - -#include -#include -#include -#include - -std::condition_variable cv; -std::mutex mut; - -int test0 = 0; -int test1 = 0; -int test2 = 0; - -void f1() -{ - std::unique_lock lk(mut); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 == 1); - test1 = 2; -} - -void f2() -{ - std::unique_lock lk(mut); - assert(test2 == 0); - while (test2 == 0) - cv.wait(lk); - assert(test2 == 1); - test2 = 2; -} - -int main() -{ - std::thread t1(f1); - std::thread t2(f2); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - { - std::unique_locklk(mut); - test1 = 1; - test2 = 1; - } - cv.notify_one(); - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - std::unique_locklk(mut); - } - if (test1 == 2) - { - t1.join(); - test1 = 0; - } - else if (test2 == 2) - { - t2.join(); - test2 = 0; - } - else - assert(false); - cv.notify_one(); - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - std::unique_locklk(mut); - } - if (test1 == 2) - { - t1.join(); - test1 = 0; - } - else if (test2 == 2) - { - t2.join(); - test2 = 0; - } - else - assert(false); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp deleted file mode 100644 index c4afc530..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// void wait(unique_lock& lock); - -#include -#include -#include -#include - -std::condition_variable cv; -std::mutex mut; - -int test1 = 0; -int test2 = 0; - -void f() -{ - std::unique_lock lk(mut); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - while (test2 == 0) - cv.wait(lk); - assert(test2 != 0); -} - -int main() -{ - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp deleted file mode 100644 index 155b3537..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp +++ /dev/null @@ -1,85 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// template -// cv_status -// wait_for(unique_lock& lock, -// const chrono::duration& rel_time); - -#include -#include -#include -#include -#include - -std::condition_variable cv; -std::mutex mut; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - typedef std::chrono::system_clock Clock; - typedef std::chrono::milliseconds milliseconds; - std::unique_lock lk(mut); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - while (test2 == 0 && - cv.wait_for(lk, milliseconds(250)) == std::cv_status::no_timeout) - ; - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < milliseconds(250)); - assert(test2 != 0); - } - else - { - assert(t1 - t0 - milliseconds(250) < milliseconds(5)); - assert(test2 == 0); - } - ++runs; -} - -int main() -{ - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.xfail.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.xfail.pass.cpp deleted file mode 100644 index 50020063..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.xfail.pass.cpp +++ /dev/null @@ -1,93 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// template -// bool -// wait_for(unique_lock& lock, -// const chrono::duration& rel_time, -// Predicate pred); - -#include -#include -#include -#include -#include - -class Pred -{ - int& i_; -public: - explicit Pred(int& i) : i_(i) {} - - bool operator()() {return i_ != 0;} -}; - -std::condition_variable cv; -std::mutex mut; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - typedef std::chrono::system_clock Clock; - typedef std::chrono::milliseconds milliseconds; - std::unique_lock lk(mut); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - bool r = cv.wait_for(lk, milliseconds(250), Pred(test2)); - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < milliseconds(250)); - assert(test2 != 0); - } - else - { - assert(t1 - t0 - milliseconds(250) < milliseconds(2)); - assert(test2 == 0); - } - ++runs; -} - -int main() -{ - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp deleted file mode 100644 index 22b82d2c..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// template -// void wait(unique_lock& lock, Predicate pred); - -#include -#include -#include -#include -#include - -std::condition_variable cv; -std::mutex mut; - -int test1 = 0; -int test2 = 0; - -class Pred -{ - int& i_; -public: - explicit Pred(int& i) : i_(i) {} - - bool operator()() {return i_ != 0;} -}; - -void f() -{ - std::unique_lock lk(mut); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - cv.wait(lk, Pred(test2)); - assert(test2 != 0); -} - -int main() -{ - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); -} diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp deleted file mode 100644 index 2fa6345e..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// template -// cv_status -// wait_until(unique_lock& lock, -// const chrono::time_point& abs_time); - -#include -#include -#include -#include -#include - -struct Clock -{ - typedef std::chrono::milliseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef std::chrono::time_point time_point; - static const bool is_steady = true; - - static time_point now() - { - using namespace std::chrono; - return time_point(duration_cast( - steady_clock::now().time_since_epoch() - )); - } -}; - -std::condition_variable cv; -std::mutex mut; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - std::unique_lock lk(mut); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - Clock::time_point t = t0 + Clock::duration(250); - while (test2 == 0 && cv.wait_until(lk, t) == std::cv_status::no_timeout) - ; - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < Clock::duration(250)); - assert(test2 != 0); - } - else - { - assert(t1 - t0 - Clock::duration(250) < Clock::duration(5)); - assert(test2 == 0); - } - ++runs; -} - -int main() -{ - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.xfail.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.xfail.pass.cpp deleted file mode 100644 index c9efb8d9..00000000 --- a/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.xfail.pass.cpp +++ /dev/null @@ -1,111 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable; - -// template -// bool -// wait_until(unique_lock& lock, -// const chrono::time_point& abs_time, -// Predicate pred); - -#include -#include -#include -#include -#include - -struct Clock -{ - typedef std::chrono::milliseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef std::chrono::time_point time_point; - static const bool is_steady = true; - - static time_point now() - { - using namespace std::chrono; - return time_point(duration_cast( - steady_clock::now().time_since_epoch() - )); - } -}; - -class Pred -{ - int& i_; -public: - explicit Pred(int& i) : i_(i) {} - - bool operator()() {return i_ != 0;} -}; - -std::condition_variable cv; -std::mutex mut; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - std::unique_lock lk(mut); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - Clock::time_point t = t0 + Clock::duration(250); - bool r = cv.wait_until(lk, t, Pred(test2)); - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < Clock::duration(250)); - assert(test2 != 0); - assert(r); - } - else - { - assert(t1 - t0 - Clock::duration(250) < Clock::duration(2)); - assert(test2 == 0); - assert(!r); - } - ++runs; -} - -int main() -{ - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - std::unique_locklk(mut); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/assign.fail.cpp b/test/thread/thread.condition/thread.condition.condvarany/assign.fail.cpp deleted file mode 100644 index 0b8d8e96..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/assign.fail.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// condition_variable_any& operator=(const condition_variable_any&) = delete; - -#include -#include - -int main() -{ - std::condition_variable_any cv0; - std::condition_variable_any cv1; - cv1 = cv0; -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/copy.fail.cpp b/test/thread/thread.condition/thread.condition.condvarany/copy.fail.cpp deleted file mode 100644 index 84902546..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/copy.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// condition_variable_any(const condition_variable_any&) = delete; - -#include -#include - -int main() -{ - std::condition_variable_any cv0; - std::condition_variable_any cv1(cv0); -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp deleted file mode 100644 index 853fc1ae..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// condition_variable_any(); - -#include -#include - -int main() -{ - std::condition_variable_any cv; -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp deleted file mode 100644 index a14c568c..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// ~condition_variable_any(); - -#include -#include -#include -#include - -std::condition_variable_any* cv; -std::mutex m; - -bool f_ready = false; -bool g_ready = false; - -void f() -{ - m.lock(); - f_ready = true; - cv->notify_one(); - delete cv; - m.unlock(); -} - -void g() -{ - m.lock(); - g_ready = true; - cv->notify_one(); - while (!f_ready) - cv->wait(m); - m.unlock(); -} - -int main() -{ - cv = new std::condition_variable_any; - std::thread th2(g); - m.lock(); - while (!g_ready) - cv->wait(m); - m.unlock(); - std::thread th1(f); - th1.join(); - th2.join(); -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp deleted file mode 100644 index 389d4bc5..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// void notify_all(); - -#include -#include -#include -#include - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test0 = 0; -int test1 = 0; -int test2 = 0; - -void f1() -{ - L1 lk(m0); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 == 1); - test1 = 2; -} - -void f2() -{ - L1 lk(m0); - assert(test2 == 0); - while (test2 == 0) - cv.wait(lk); - assert(test2 == 1); - test2 = 2; -} - -int main() -{ - std::thread t1(f1); - std::thread t2(f2); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - { - L1 lk(m0); - test1 = 1; - test2 = 1; - } - cv.notify_all(); - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - L1 lk(m0); - } - t1.join(); - t2.join(); - assert(test1 == 2); - assert(test2 == 2); -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp deleted file mode 100644 index 8ad0ca37..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp +++ /dev/null @@ -1,96 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// void notify_one(); - -#include -#include -#include -#include - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test0 = 0; -int test1 = 0; -int test2 = 0; - -void f1() -{ - L1 lk(m0); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 == 1); - test1 = 2; -} - -void f2() -{ - L1 lk(m0); - assert(test2 == 0); - while (test2 == 0) - cv.wait(lk); - assert(test2 == 1); - test2 = 2; -} - -int main() -{ - std::thread t1(f1); - std::thread t2(f2); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - { - L1 lk(m0); - test1 = 1; - test2 = 1; - } - cv.notify_one(); - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - L1 lk(m0); - } - if (test1 == 2) - { - t1.join(); - test1 = 0; - } - else if (test2 == 2) - { - t2.join(); - test2 = 0; - } - else - assert(false); - cv.notify_one(); - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - L1 lk(m0); - } - if (test1 == 2) - { - t1.join(); - test1 = 0; - } - else if (test2 == 2) - { - t2.join(); - test2 = 0; - } - else - assert(false); -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp deleted file mode 100644 index b6111670..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// template -// void wait(Lock& lock); - -#include -#include -#include -#include - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test1 = 0; -int test2 = 0; - -void f() -{ - L1 lk(m0); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - while (test2 == 0) - cv.wait(lk); - assert(test2 != 0); -} - -int main() -{ - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp deleted file mode 100644 index d50ad40f..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// template -// cv_status -// wait_for(Lock& lock, const chrono::duration& rel_time); - -#include -#include -#include -#include -#include - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - typedef std::chrono::system_clock Clock; - typedef std::chrono::milliseconds milliseconds; - L1 lk(m0); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - while (test2 == 0 && - cv.wait_for(lk, milliseconds(250)) == std::cv_status::no_timeout) - ; - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < milliseconds(250)); - assert(test2 != 0); - } - else - { - assert(t1 - t0 - milliseconds(250) < milliseconds(5)); - assert(test2 == 0); - } - ++runs; -} - -int main() -{ - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp deleted file mode 100644 index 856297db..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp +++ /dev/null @@ -1,96 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// template -// bool -// wait_for(Lock& lock, const chrono::duration& rel_time, -// Predicate pred); - -#include -#include -#include -#include -#include - -class Pred -{ - int& i_; -public: - explicit Pred(int& i) : i_(i) {} - - bool operator()() {return i_ != 0;} -}; - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - typedef std::chrono::system_clock Clock; - typedef std::chrono::milliseconds milliseconds; - L1 lk(m0); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - bool r = cv.wait_for(lk, milliseconds(250), Pred(test2)); - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < milliseconds(250)); - assert(test2 != 0); - } - else - { - assert(t1 - t0 - milliseconds(250) < milliseconds(5)); - assert(test2 == 0); - } - ++runs; -} - -int main() -{ - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp deleted file mode 100644 index 9b4fab3d..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// template -// void wait(Lock& lock, Predicate pred); - -#include -#include -#include -#include -#include - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test1 = 0; -int test2 = 0; - -class Pred -{ - int& i_; -public: - explicit Pred(int& i) : i_(i) {} - - bool operator()() {return i_ != 0;} -}; - -void f() -{ - L1 lk(m0); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - cv.wait(lk, Pred(test2)); - assert(test2 != 0); -} - -int main() -{ - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp deleted file mode 100644 index 7b21660c..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp +++ /dev/null @@ -1,103 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// template -// cv_status -// wait_until(Lock& lock, const chrono::time_point& abs_time); - -#include -#include -#include -#include -#include - -struct Clock -{ - typedef std::chrono::milliseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef std::chrono::time_point time_point; - static const bool is_steady = true; - - static time_point now() - { - using namespace std::chrono; - return time_point(duration_cast( - steady_clock::now().time_since_epoch() - )); - } -}; - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - L1 lk(m0); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - Clock::time_point t = t0 + Clock::duration(250); - while (test2 == 0 && cv.wait_until(lk, t) == std::cv_status::no_timeout) - ; - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < Clock::duration(250)); - assert(test2 != 0); - } - else - { - assert(t1 - t0 - Clock::duration(250) < Clock::duration(5)); - assert(test2 == 0); - } - ++runs; -} - -int main() -{ - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.xfail.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.xfail.pass.cpp deleted file mode 100644 index 7c349319..00000000 --- a/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.xfail.pass.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class condition_variable_any; - -// template -// bool -// wait_until(Lock& lock, -// const chrono::time_point& abs_time, -// Predicate pred); - -#include -#include -#include -#include -#include - -struct Clock -{ - typedef std::chrono::milliseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef std::chrono::time_point time_point; - static const bool is_steady = true; - - static time_point now() - { - using namespace std::chrono; - return time_point(duration_cast( - steady_clock::now().time_since_epoch() - )); - } -}; - -class Pred -{ - int& i_; -public: - explicit Pred(int& i) : i_(i) {} - - bool operator()() {return i_ != 0;} -}; - -std::condition_variable_any cv; - -typedef std::timed_mutex L0; -typedef std::unique_lock L1; - -L0 m0; - -int test1 = 0; -int test2 = 0; - -int runs = 0; - -void f() -{ - L1 lk(m0); - assert(test2 == 0); - test1 = 1; - cv.notify_one(); - Clock::time_point t0 = Clock::now(); - Clock::time_point t = t0 + Clock::duration(250); - bool r = cv.wait_until(lk, t, Pred(test2)); - Clock::time_point t1 = Clock::now(); - if (runs == 0) - { - assert(t1 - t0 < Clock::duration(250)); - assert(test2 != 0); - assert(r); - } - else - { - assert(t1 - t0 - Clock::duration(250) < Clock::duration(2)); - assert(test2 == 0); - assert(!r); - } - ++runs; -} - -int main() -{ - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - test2 = 1; - lk.unlock(); - cv.notify_one(); - t.join(); - } - test1 = 0; - test2 = 0; - { - L1 lk(m0); - std::thread t(f); - assert(test1 == 0); - while (test1 == 0) - cv.wait(lk); - assert(test1 != 0); - lk.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.condition/version.pass.cpp b/test/thread/thread.condition/version.pass.cpp deleted file mode 100644 index 517c93b7..00000000 --- a/test/thread/thread.condition/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/thread/thread.general/nothing_to_do.pass.cpp b/test/thread/thread.general/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.general/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp deleted file mode 100644 index 14c79a10..00000000 --- a/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp +++ /dev/null @@ -1,505 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// void lock(L1&, L2&, L3&...); - -#include -#include - -class L0 -{ - bool locked_; - -public: - L0() : locked_(false) {} - - void lock() - { - locked_ = true; - } - - bool try_lock() - { - locked_ = true; - return locked_; - } - - void unlock() {locked_ = false;} - - bool locked() const {return locked_;} -}; - -class L1 -{ - bool locked_; - -public: - L1() : locked_(false) {} - - void lock() - { - locked_ = true; - } - - bool try_lock() - { - locked_ = false; - return locked_; - } - - void unlock() {locked_ = false;} - - bool locked() const {return locked_;} -}; - -class L2 -{ - bool locked_; - -public: - L2() : locked_(false) {} - - void lock() - { - throw 1; - } - - bool try_lock() - { - throw 1; - return locked_; - } - - void unlock() {locked_ = false;} - - bool locked() const {return locked_;} -}; - -int main() -{ - { - L0 l0; - L0 l1; - std::lock(l0, l1); - assert(l0.locked()); - assert(l1.locked()); - } - { - L0 l0; - L1 l1; - std::lock(l0, l1); - assert(l0.locked()); - assert(l1.locked()); - } - { - L1 l0; - L0 l1; - std::lock(l0, l1); - assert(l0.locked()); - assert(l1.locked()); - } - { - L0 l0; - L2 l1; - try - { - std::lock(l0, l1); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - } - } - { - L2 l0; - L0 l1; - try - { - std::lock(l0, l1); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - } - } - { - L1 l0; - L2 l1; - try - { - std::lock(l0, l1); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - } - } - { - L2 l0; - L1 l1; - try - { - std::lock(l0, l1); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - } - } - { - L2 l0; - L2 l1; - try - { - std::lock(l0, l1); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - } - } -#ifndef _LIBCPP_HAS_NO_VARIADICS - { - L0 l0; - L0 l1; - L0 l2; - std::lock(l0, l1, l2); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - } - { - L2 l0; - L2 l1; - L2 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L0 l1; - L1 l2; - std::lock(l0, l1, l2); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - } - { - L0 l0; - L1 l1; - L0 l2; - std::lock(l0, l1, l2); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - } - { - L1 l0; - L0 l1; - L0 l2; - std::lock(l0, l1, l2); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - } - { - L0 l0; - L0 l1; - L2 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L2 l1; - L0 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L0 l1; - L0 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L2 l1; - L0 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L0 l1; - L2 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L2 l1; - L2 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L2 l1; - L1 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L1 l1; - L2 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L1 l0; - L2 l1; - L2 l2; - try - { - std::lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L0 l1; - L0 l2; - L0 l3; - std::lock(l0, l1, l2, l3); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - assert(l3.locked()); - } - { - L0 l0; - L0 l1; - L0 l2; - L1 l3; - std::lock(l0, l1, l2, l3); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - assert(l3.locked()); - } - { - L0 l0; - L0 l1; - L1 l2; - L0 l3; - std::lock(l0, l1, l2, l3); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - assert(l3.locked()); - } - { - L0 l0; - L1 l1; - L0 l2; - L0 l3; - std::lock(l0, l1, l2, l3); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - assert(l3.locked()); - } - { - L1 l0; - L0 l1; - L0 l2; - L0 l3; - std::lock(l0, l1, l2, l3); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - assert(l3.locked()); - } - { - L0 l0; - L0 l1; - L0 l2; - L2 l3; - try - { - std::lock(l0, l1, l2, l3); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } - } - { - L0 l0; - L0 l1; - L2 l2; - L0 l3; - try - { - std::lock(l0, l1, l2, l3); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } - } - { - L0 l0; - L2 l1; - L0 l2; - L0 l3; - try - { - std::lock(l0, l1, l2, l3); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } - } - { - L2 l0; - L0 l1; - L0 l2; - L0 l3; - try - { - std::lock(l0, l1, l2, l3); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } - } -#endif // _LIBCPP_HAS_NO_VARIADICS -} diff --git a/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp deleted file mode 100644 index bdb76c67..00000000 --- a/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp +++ /dev/null @@ -1,514 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// int try_lock(L1&, L2&, L3&...); - -#include -#include - -class L0 -{ - bool locked_; - -public: - L0() : locked_(false) {} - - bool try_lock() - { - locked_ = true; - return locked_; - } - - void unlock() {locked_ = false;} - - bool locked() const {return locked_;} -}; - -class L1 -{ - bool locked_; - -public: - L1() : locked_(false) {} - - bool try_lock() - { - locked_ = false; - return locked_; - } - - void unlock() {locked_ = false;} - - bool locked() const {return locked_;} -}; - -class L2 -{ - bool locked_; - -public: - L2() : locked_(false) {} - - bool try_lock() - { - throw 1; - return locked_; - } - - void unlock() {locked_ = false;} - - bool locked() const {return locked_;} -}; - -int main() -{ - { - L0 l0; - L0 l1; - assert(std::try_lock(l0, l1) == -1); - assert(l0.locked()); - assert(l1.locked()); - } - { - L0 l0; - L1 l1; - assert(std::try_lock(l0, l1) == 1); - assert(!l0.locked()); - assert(!l1.locked()); - } - { - L1 l0; - L0 l1; - assert(std::try_lock(l0, l1) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - } - { - L0 l0; - L2 l1; - try - { - std::try_lock(l0, l1); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - } - } - { - L2 l0; - L0 l1; - try - { - std::try_lock(l0, l1); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - } - } -#ifndef _LIBCPP_HAS_NO_VARIADICS - { - L0 l0; - L0 l1; - L0 l2; - assert(std::try_lock(l0, l1, l2) == -1); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - } - { - L1 l0; - L1 l1; - L1 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L2 l0; - L2 l1; - L2 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L1 l1; - L2 l2; - assert(std::try_lock(l0, l1, l2) == 1); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L0 l0; - L0 l1; - L1 l2; - assert(std::try_lock(l0, l1, l2) == 2); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L0 l0; - L1 l1; - L0 l2; - assert(std::try_lock(l0, l1, l2) == 1); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L1 l0; - L0 l1; - L0 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L0 l0; - L0 l1; - L2 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L2 l1; - L0 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L0 l1; - L0 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L1 l0; - L1 l1; - L0 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L1 l0; - L0 l1; - L1 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L0 l0; - L1 l1; - L1 l2; - assert(std::try_lock(l0, l1, l2) == 1); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L1 l0; - L1 l1; - L2 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L1 l0; - L2 l1; - L1 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L2 l0; - L1 l1; - L1 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L2 l1; - L0 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L0 l1; - L2 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L2 l1; - L2 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L2 l1; - L1 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L1 l1; - L2 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L1 l0; - L2 l1; - L2 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L0 l0; - L2 l1; - L1 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L1 l0; - L0 l1; - L2 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L1 l0; - L2 l1; - L0 l2; - assert(std::try_lock(l0, l1, l2) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - { - L2 l0; - L0 l1; - L1 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L2 l0; - L1 l1; - L0 l2; - try - { - std::try_lock(l0, l1, l2); - assert(false); - } - catch (int) - { - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - } - } - { - L0 l0; - L0 l1; - L0 l2; - L0 l3; - assert(std::try_lock(l0, l1, l2, l3) == -1); - assert(l0.locked()); - assert(l1.locked()); - assert(l2.locked()); - assert(l3.locked()); - } - { - L1 l0; - L0 l1; - L0 l2; - L0 l3; - assert(std::try_lock(l0, l1, l2, l3) == 0); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } - { - L0 l0; - L1 l1; - L0 l2; - L0 l3; - assert(std::try_lock(l0, l1, l2, l3) == 1); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } - { - L0 l0; - L0 l1; - L1 l2; - L0 l3; - assert(std::try_lock(l0, l1, l2, l3) == 2); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } - { - L0 l0; - L0 l1; - L0 l2; - L1 l3; - assert(std::try_lock(l0, l1, l2, l3) == 3); - assert(!l0.locked()); - assert(!l1.locked()); - assert(!l2.locked()); - assert(!l3.locked()); - } -#endif // _LIBCPP_HAS_NO_VARIADICS -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp deleted file mode 100644 index 57341e87..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class lock_guard; - -// lock_guard(mutex_type& m, adopt_lock_t); - -#include -#include -#include -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - time_point t1; - { - m.lock(); - std::lock_guard lg(m, std::adopt_lock); - t1 = Clock::now(); - } - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/assign.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/assign.fail.cpp deleted file mode 100644 index 53abb42c..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/assign.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class lock_guard; - -// lock_guard& operator=(lock_guard const&) = delete; - -#include - -int main() -{ - std::mutex m0; - std::mutex m1; - std::lock_guard lg0(m0); - std::lock_guard lg(m1); - lg = lg0; -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/copy.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/copy.fail.cpp deleted file mode 100644 index 296ccdae..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/copy.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class lock_guard; - -// lock_guard(lock_guard const&) = delete; - -#include - -int main() -{ - std::mutex m; - std::lock_guard lg0(m); - std::lock_guard lg(lg0); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp deleted file mode 100644 index 246eb935..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class lock_guard; - -// explicit lock_guard(mutex_type& m); - -#include -#include -#include -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - time_point t1; - { - std::lock_guard lg = m; - t1 = Clock::now(); - } - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp deleted file mode 100644 index a0bcd387..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class lock_guard; - -// explicit lock_guard(mutex_type& m); - -#include -#include -#include -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - time_point t1; - { - std::lock_guard lg(m); - t1 = Clock::now(); - } - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp deleted file mode 100644 index 20aa62e4..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// class lock_guard -// { -// public: -// typedef Mutex mutex_type; -// ... -// }; - -#include -#include - -int main() -{ - static_assert((std::is_same::mutex_type, - std::mutex>::value), ""); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp deleted file mode 100644 index 4f477449..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock& operator=(unique_lock const&) = delete; - -#include -#include - -std::mutex m0; -std::mutex m1; - -int main() -{ - std::unique_lock lk0(m0); - std::unique_lock lk1(m1); - lk1 = lk0; - assert(lk1.mutex() == &m0); - assert(lk1.owns_lock() == true); - assert(lk0.mutex() == nullptr); - assert(lk0.owns_lock() == false); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp deleted file mode 100644 index 4888fe90..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock(unique_lock const&) = delete; - -#include -#include - -std::mutex m; - -int main() -{ - std::unique_lock lk0(m); - std::unique_lock lk = lk0; - assert(lk.mutex() == &m); - assert(lk.owns_lock() == true); - assert(lk0.mutex() == nullptr); - assert(lk0.owns_lock() == false); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp deleted file mode 100644 index 55038c76..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock(); - -#include -#include - -int main() -{ - std::unique_lock ul; - assert(!ul.owns_lock()); - assert(ul.mutex() == nullptr); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp deleted file mode 100644 index 2eb1c3a5..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock& operator=(unique_lock&& u); - -#include -#include - -std::mutex m0; -std::mutex m1; - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::unique_lock lk0(m0); - std::unique_lock lk1(m1); - lk1 = std::move(lk0); - assert(lk1.mutex() == &m0); - assert(lk1.owns_lock() == true); - assert(lk0.mutex() == nullptr); - assert(lk0.owns_lock() == false); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp deleted file mode 100644 index f36600c6..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock(unique_lock&& u); - -#include -#include - -std::mutex m; - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::unique_lock lk0(m); - std::unique_lock lk = std::move(lk0); - assert(lk.mutex() == &m); - assert(lk.owns_lock() == true); - assert(lk0.mutex() == nullptr); - assert(lk0.owns_lock() == false); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp deleted file mode 100644 index 6c12e1fa..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// explicit unique_lock(mutex_type& m); - -#include -#include -#include -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - time_point t1; - { - std::unique_lock ul(m); - t1 = Clock::now(); - } - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp deleted file mode 100644 index ff8043b5..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock(mutex_type& m, adopt_lock_t); - -#include -#include - -int main() -{ - std::mutex m; - m.lock(); - std::unique_lock lk(m, std::adopt_lock); - assert(lk.mutex() == &m); - assert(lk.owns_lock() == true); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp deleted file mode 100644 index f475ec1b..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock(mutex_type& m, defer_lock_t); - -#include -#include - -int main() -{ - std::mutex m; - std::unique_lock lk(m, std::defer_lock); - assert(lk.mutex() == &m); - assert(lk.owns_lock() == false); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp deleted file mode 100644 index 137c913e..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// template -// unique_lock(mutex_type& m, const chrono::duration& rel_time); - -#include -#include -#include -#include - -std::timed_mutex m; - -typedef std::chrono::steady_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f1() -{ - time_point t0 = Clock::now(); - std::unique_lock lk(m, ms(300)); - assert(lk.owns_lock() == true); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -void f2() -{ - time_point t0 = Clock::now(); - std::unique_lock lk(m, ms(250)); - assert(lk.owns_lock() == false); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -int main() -{ - { - m.lock(); - std::thread t(f1); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); - } - { - m.lock(); - std::thread t(f2); - std::this_thread::sleep_for(ms(300)); - m.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp deleted file mode 100644 index 21ee88d7..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// template -// unique_lock(mutex_type& m, const chrono::time_point& abs_time); - -#include -#include -#include -#include - -std::timed_mutex m; - -typedef std::chrono::steady_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f1() -{ - time_point t0 = Clock::now(); - std::unique_lock lk(m, Clock::now() + ms(300)); - assert(lk.owns_lock() == true); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -void f2() -{ - time_point t0 = Clock::now(); - std::unique_lock lk(m, Clock::now() + ms(250)); - assert(lk.owns_lock() == false); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -int main() -{ - { - m.lock(); - std::thread t(f1); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); - } - { - m.lock(); - std::thread t(f2); - std::this_thread::sleep_for(ms(300)); - m.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp deleted file mode 100644 index 999dc19d..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// unique_lock(mutex_type& m, try_to_lock_t); - -#include -#include -#include -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - { - std::unique_lock lk(m, std::try_to_lock); - assert(lk.owns_lock() == false); - } - { - std::unique_lock lk(m, std::try_to_lock); - assert(lk.owns_lock() == false); - } - { - std::unique_lock lk(m, std::try_to_lock); - assert(lk.owns_lock() == false); - } - while (true) - { - std::unique_lock lk(m, std::try_to_lock); - if (lk.owns_lock()) - break; - } - time_point t1 = Clock::now(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp deleted file mode 100644 index fa50c7b3..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// void lock(); - -#include -#include -#include -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - std::unique_lock lk(m, std::defer_lock); - time_point t0 = Clock::now(); - lk.lock(); - time_point t1 = Clock::now(); - assert(lk.owns_lock() == true); - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms - try - { - lk.lock(); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EDEADLK); - } - lk.unlock(); - lk.release(); - try - { - lk.lock(); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EPERM); - } -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp deleted file mode 100644 index 40d9489e..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// bool try_lock(); - -#include -#include - -bool try_lock_called = false; - -struct mutex -{ - bool try_lock() - { - try_lock_called = !try_lock_called; - return try_lock_called; - } - void unlock() {} -}; - -mutex m; - -int main() -{ - std::unique_lock lk(m, std::defer_lock); - assert(lk.try_lock() == true); - assert(try_lock_called == true); - assert(lk.owns_lock() == true); - try - { - lk.try_lock(); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EDEADLK); - } - lk.unlock(); - assert(lk.try_lock() == false); - assert(try_lock_called == false); - assert(lk.owns_lock() == false); - lk.release(); - try - { - lk.try_lock(); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EPERM); - } -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp deleted file mode 100644 index 3e7d13a4..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// template -// bool try_lock_for(const chrono::duration& rel_time); - -#include -#include - -bool try_lock_for_called = false; - -typedef std::chrono::milliseconds ms; - -struct mutex -{ - template - bool try_lock_for(const std::chrono::duration& rel_time) - { - assert(rel_time == ms(5)); - try_lock_for_called = !try_lock_for_called; - return try_lock_for_called; - } - void unlock() {} -}; - -mutex m; - -int main() -{ - std::unique_lock lk(m, std::defer_lock); - assert(lk.try_lock_for(ms(5)) == true); - assert(try_lock_for_called == true); - assert(lk.owns_lock() == true); - try - { - lk.try_lock_for(ms(5)); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EDEADLK); - } - lk.unlock(); - assert(lk.try_lock_for(ms(5)) == false); - assert(try_lock_for_called == false); - assert(lk.owns_lock() == false); - lk.release(); - try - { - lk.try_lock_for(ms(5)); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EPERM); - } -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp deleted file mode 100644 index 2b435e06..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// template -// bool try_lock_until(const chrono::time_point& abs_time); - -#include -#include - -bool try_lock_until_called = false; - -struct mutex -{ - template - bool try_lock_until(const std::chrono::time_point& abs_time) - { - typedef std::chrono::milliseconds ms; - assert(Clock::now() - abs_time < ms(5)); - try_lock_until_called = !try_lock_until_called; - return try_lock_until_called; - } - void unlock() {} -}; - -mutex m; - -int main() -{ - typedef std::chrono::steady_clock Clock; - std::unique_lock lk(m, std::defer_lock); - assert(lk.try_lock_until(Clock::now()) == true); - assert(try_lock_until_called == true); - assert(lk.owns_lock() == true); - try - { - lk.try_lock_until(Clock::now()); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EDEADLK); - } - lk.unlock(); - assert(lk.try_lock_until(Clock::now()) == false); - assert(try_lock_until_called == false); - assert(lk.owns_lock() == false); - lk.release(); - try - { - lk.try_lock_until(Clock::now()); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EPERM); - } -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp deleted file mode 100644 index 1318c86d..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// void unlock(); - -#include -#include - -bool unlock_called = false; - -struct mutex -{ - void lock() {} - void unlock() {unlock_called = true;} -}; - -mutex m; - -int main() -{ - std::unique_lock lk(m); - lk.unlock(); - assert(unlock_called == true); - assert(lk.owns_lock() == false); - try - { - lk.unlock(); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EPERM); - } - lk.release(); - try - { - lk.unlock(); - assert(false); - } - catch (std::system_error& e) - { - assert(e.code().value() == EPERM); - } -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp deleted file mode 100644 index fd3931a2..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// void swap(unique_lock& u); - -#include -#include - -struct mutex -{ - void lock() {} - void unlock() {} -}; - -mutex m; - -int main() -{ - std::unique_lock lk1(m); - std::unique_lock lk2; - lk1.swap(lk2); - assert(lk1.mutex() == nullptr); - assert(lk1.owns_lock() == false); - assert(lk2.mutex() == &m); - assert(lk2.owns_lock() == true); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp deleted file mode 100644 index d74247e0..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// template -// void swap(unique_lock& x, unique_lock& y); - -#include -#include - -struct mutex -{ - void lock() {} - void unlock() {} -}; - -mutex m; - -int main() -{ - std::unique_lock lk1(m); - std::unique_lock lk2; - swap(lk1, lk2); - assert(lk1.mutex() == nullptr); - assert(lk1.owns_lock() == false); - assert(lk2.mutex() == &m); - assert(lk2.owns_lock() == true); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp deleted file mode 100644 index 0efe7d64..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// void swap(unique_lock& u); - -#include -#include - -struct mutex -{ - static int lock_count; - static int unlock_count; - void lock() {++lock_count;} - void unlock() {++unlock_count;} -}; - -int mutex::lock_count = 0; -int mutex::unlock_count = 0; - -mutex m; - -int main() -{ - std::unique_lock lk(m); - assert(lk.mutex() == &m); - assert(lk.owns_lock() == true); - assert(mutex::lock_count == 1); - assert(mutex::unlock_count == 0); - assert(lk.release() == &m); - assert(lk.mutex() == nullptr); - assert(lk.owns_lock() == false); - assert(mutex::lock_count == 1); - assert(mutex::unlock_count == 0); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp deleted file mode 100644 index 78b0c6aa..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// mutex_type *mutex() const; - -#include -#include - -std::mutex m; - -int main() -{ - std::unique_lock lk0; - assert(lk0.mutex() == nullptr); - std::unique_lock lk1(m); - assert(lk1.mutex() == &m); - lk1.unlock(); - assert(lk1.mutex() == &m); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp deleted file mode 100644 index 6648ca5a..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// explicit operator bool() const; - -#include -#include - -std::mutex m; - -int main() -{ - std::unique_lock lk0; - assert(lk0 == false); - std::unique_lock lk1(m); - assert(lk1 == true); - lk1.unlock(); - assert(lk1 == false); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp deleted file mode 100644 index 2e2db5da..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template class unique_lock; - -// bool owns_lock() const; - -#include -#include - -std::mutex m; - -int main() -{ - std::unique_lock lk0; - assert(lk0.owns_lock() == false); - std::unique_lock lk1(m); - assert(lk1.owns_lock() == true); - lk1.unlock(); - assert(lk1.owns_lock() == false); -} diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp deleted file mode 100644 index aba22a7e..00000000 --- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// class unique_lock -// { -// public: -// typedef Mutex mutex_type; -// ... -// }; - -#include -#include - -int main() -{ - static_assert((std::is_same::mutex_type, - std::mutex>::value), ""); -} diff --git a/test/thread/thread.mutex/thread.lock/types.pass.cpp b/test/thread/thread.mutex/thread.lock/types.pass.cpp deleted file mode 100644 index 8a34bcbb..00000000 --- a/test/thread/thread.mutex/thread.lock/types.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// struct defer_lock_t {}; -// struct try_to_lock_t {}; -// struct adopt_lock_t {}; -// -// constexpr defer_lock_t defer_lock{}; -// constexpr try_to_lock_t try_to_lock{}; -// constexpr adopt_lock_t adopt_lock{}; - -#include -#include - -int main() -{ - typedef std::defer_lock_t T1; - 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; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.general/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.general/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.general/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/assign.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/assign.fail.cpp deleted file mode 100644 index 7f6333af..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/assign.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class mutex; - -// mutex& operator=(const mutex&) = delete; - -#include - -int main() -{ - std::mutex m0; - std::mutex m1; - m1 = m0; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/copy.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/copy.fail.cpp deleted file mode 100644 index 7e1a07ac..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/copy.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class mutex; - -// mutex(const mutex&) = delete; - -#include - -int main() -{ - std::mutex m0; - std::mutex m1(m0); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp deleted file mode 100644 index 704d7162..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class mutex; - -// mutex(); - -#include - -int main() -{ - std::mutex m; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/lock.pass.cpp deleted file mode 100644 index 222ebcb0..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/lock.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class mutex; - -// void lock(); - -#include -#include -#include -#include - -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - m.lock(); - time_point t1 = Clock::now(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp deleted file mode 100644 index 59c762a0..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class mutex; - -// typedef pthread_mutex_t* native_handle_type; -// native_handle_type native_handle(); - -#include -#include - -int main() -{ - std::mutex m; - pthread_mutex_t* h = m.native_handle(); - assert(h); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp deleted file mode 100644 index 0d248c29..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class mutex; - -// bool try_lock(); - -#include -#include -#include -#include - -std::mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - assert(!m.try_lock()); - assert(!m.try_lock()); - assert(!m.try_lock()); - while(!m.try_lock()) - ; - time_point t1 = Clock::now(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/assign.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/assign.fail.cpp deleted file mode 100644 index 61b56216..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/assign.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_mutex; - -// recursive_mutex& operator=(const recursive_mutex&) = delete; - -#include - -int main() -{ - std::recursive_mutex m0; - std::recursive_mutex m1; - m1 = m0; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/copy.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/copy.fail.cpp deleted file mode 100644 index 0239c047..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/copy.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_mutex; - -// recursive_mutex(const recursive_mutex&) = delete; - -#include - -int main() -{ - std::recursive_mutex m0; - std::recursive_mutex m1(m0); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/default.pass.cpp deleted file mode 100644 index bc775edf..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/default.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_mutex; - -// recursive_mutex(); - -#include - -int main() -{ - std::recursive_mutex m; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp deleted file mode 100644 index c0087b89..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_mutex; - -// void lock(); - -#include -#include -#include -#include - -#include - -std::recursive_mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - m.lock(); - time_point t1 = Clock::now(); - m.lock(); - m.unlock(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp deleted file mode 100644 index fb952946..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_mutex; - -// typedef pthread_mutex_t* native_handle_type; -// native_handle_type native_handle(); - -#include -#include - -int main() -{ - std::recursive_mutex m; - pthread_mutex_t* h = m.native_handle(); - assert(h); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/try_lock.pass.cpp deleted file mode 100644 index 2f82d4fd..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/try_lock.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_mutex; - -// bool try_lock(); - -#include -#include -#include -#include - -std::recursive_mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - assert(!m.try_lock()); - assert(!m.try_lock()); - assert(!m.try_lock()); - while(!m.try_lock()) - ; - time_point t1 = Clock::now(); - assert(m.try_lock()); - m.unlock(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/assign.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/assign.fail.cpp deleted file mode 100644 index 58006833..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/assign.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// timed_mutex& operator=(const timed_mutex&) = delete; - -#include - -int main() -{ - std::timed_mutex m0; - std::timed_mutex m1; - m1 = m0; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/copy.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/copy.fail.cpp deleted file mode 100644 index 61ba31d8..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/copy.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// timed_mutex(const timed_mutex&) = delete; - -#include - -int main() -{ - std::timed_mutex m0; - std::timed_mutex m1(m0); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp deleted file mode 100644 index 5956540e..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// timed_mutex(); - -#include - -int main() -{ - std::timed_mutex m; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp deleted file mode 100644 index be34e6db..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// void lock(); - -#include -#include -#include -#include - -#include - -std::timed_mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - m.lock(); - time_point t1 = Clock::now(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp deleted file mode 100644 index 41ddbbcf..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// bool try_lock(); - -#include -#include -#include -#include - -std::timed_mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - assert(!m.try_lock()); - assert(!m.try_lock()); - assert(!m.try_lock()); - while(!m.try_lock()) - ; - time_point t1 = Clock::now(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp deleted file mode 100644 index 1253659e..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// template -// bool try_lock_for(const chrono::duration& rel_time); - -#include -#include -#include -#include - -std::timed_mutex m; - -typedef std::chrono::steady_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f1() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_for(ms(300)) == true); - time_point t1 = Clock::now(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -void f2() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_for(ms(250)) == false); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -int main() -{ - { - m.lock(); - std::thread t(f1); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); - } - { - m.lock(); - std::thread t(f2); - std::this_thread::sleep_for(ms(300)); - m.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp deleted file mode 100644 index ac70d4a9..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class timed_mutex; - -// template -// bool try_lock_until(const chrono::time_point& abs_time); - -#include -#include -#include -#include - -std::timed_mutex m; - -typedef std::chrono::steady_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f1() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_until(Clock::now() + ms(300)) == true); - time_point t1 = Clock::now(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -void f2() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_until(Clock::now() + ms(250)) == false); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -int main() -{ - { - m.lock(); - std::thread t(f1); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); - } - { - m.lock(); - std::thread t(f2); - std::this_thread::sleep_for(ms(300)); - m.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/assign.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/assign.fail.cpp deleted file mode 100644 index ae84be83..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/assign.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_timed_mutex; - -// recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; - -#include - -int main() -{ - std::recursive_timed_mutex m0; - std::recursive_timed_mutex m1; - m1 = m0; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/copy.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/copy.fail.cpp deleted file mode 100644 index 487d6a8c..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/copy.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_timed_mutex; - -// recursive_timed_mutex(const recursive_timed_mutex&) = delete; - -#include - -int main() -{ - std::recursive_timed_mutex m0; - std::recursive_timed_mutex m1(m0); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp deleted file mode 100644 index a4c5110e..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_timed_mutex; - -// recursive_timed_mutex(); - -#include - -int main() -{ - std::recursive_timed_mutex m; -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp deleted file mode 100644 index b00fa46e..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_timed_mutex; - -// void lock(); - -#include -#include -#include -#include - -#include - -std::recursive_timed_mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - m.lock(); - time_point t1 = Clock::now(); - m.lock(); - m.unlock(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(2500000)); // within 2.5ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp deleted file mode 100644 index fe5ef80a..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_timed_mutex; - -// bool try_lock(); - -#include -#include -#include -#include - -std::recursive_timed_mutex m; - -typedef std::chrono::system_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f() -{ - time_point t0 = Clock::now(); - assert(!m.try_lock()); - assert(!m.try_lock()); - assert(!m.try_lock()); - while(!m.try_lock()) - ; - time_point t1 = Clock::now(); - assert(m.try_lock()); - m.unlock(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -int main() -{ - m.lock(); - std::thread t(f); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp deleted file mode 100644 index 972fc637..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_timed_mutex; - -// template -// bool try_lock_for(const chrono::duration& rel_time); - -#include -#include -#include -#include - -std::recursive_timed_mutex m; - -typedef std::chrono::steady_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f1() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_for(ms(300)) == true); - time_point t1 = Clock::now(); - assert(m.try_lock()); - m.unlock(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -void f2() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_for(ms(250)) == false); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(50000000)); // within 50ms -} - -int main() -{ - { - m.lock(); - std::thread t(f1); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); - } - { - m.lock(); - std::thread t(f2); - std::this_thread::sleep_for(ms(300)); - m.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp deleted file mode 100644 index bfda9edc..00000000 --- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class recursive_timed_mutex; - -// template -// bool try_lock_until(const chrono::time_point& abs_time); - -#include -#include -#include -#include - -std::recursive_timed_mutex m; - -typedef std::chrono::steady_clock Clock; -typedef Clock::time_point time_point; -typedef Clock::duration duration; -typedef std::chrono::milliseconds ms; -typedef std::chrono::nanoseconds ns; - -void f1() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_until(Clock::now() + ms(300)) == true); - time_point t1 = Clock::now(); - assert(m.try_lock()); - m.unlock(); - m.unlock(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -void f2() -{ - time_point t0 = Clock::now(); - assert(m.try_lock_until(Clock::now() + ms(250)) == false); - time_point t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - assert(d < ns(5000000)); // within 5ms -} - -int main() -{ - { - m.lock(); - std::thread t(f1); - std::this_thread::sleep_for(ms(250)); - m.unlock(); - t.join(); - } - { - m.lock(); - std::thread t(f2); - std::this_thread::sleep_for(ms(300)); - m.unlock(); - t.join(); - } -} diff --git a/test/thread/thread.mutex/thread.once/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.once/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.mutex/thread.once/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp deleted file mode 100644 index 68ee4394..00000000 --- a/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp +++ /dev/null @@ -1,178 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// struct once_flag; - -// template -// void call_once(once_flag& flag, Callable func, Args&&... args); - -#include -#include -#include - -typedef std::chrono::milliseconds ms; - -std::once_flag flg0; - -int init0_called = 0; - -void init0() -{ - std::this_thread::sleep_for(ms(250)); - ++init0_called; -} - -void f0() -{ - std::call_once(flg0, init0); -} - -std::once_flag flg3; - -int init3_called = 0; -int init3_completed = 0; - -void init3() -{ - ++init3_called; - std::this_thread::sleep_for(ms(250)); - if (init3_called == 1) - throw 1; - ++init3_completed; -} - -void f3() -{ - try - { - std::call_once(flg3, init3); - } - catch (...) - { - } -} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - -struct init1 -{ - static int called; - - void operator()(int i) {called += i;} -}; - -int init1::called = 0; - -std::once_flag flg1; - -void f1() -{ - std::call_once(flg1, init1(), 1); -} - -struct init2 -{ - static int called; - - void operator()(int i, int j) const {called += i + j;} -}; - -int init2::called = 0; - -std::once_flag flg2; - -void f2() -{ - std::call_once(flg2, init2(), 2, 3); - std::call_once(flg2, init2(), 4, 5); -} - -#endif // _LIBCPP_HAS_NO_VARIADICS - -std::once_flag flg41; -std::once_flag flg42; - -int init41_called = 0; -int init42_called = 0; - -void init42(); - -void init41() -{ - std::this_thread::sleep_for(ms(250)); - ++init41_called; -} - -void init42() -{ - std::this_thread::sleep_for(ms(250)); - ++init42_called; -} - -void f41() -{ - std::call_once(flg41, init41); - std::call_once(flg42, init42); -} - -void f42() -{ - std::call_once(flg42, init42); - std::call_once(flg41, init41); -} - -int main() -{ - // check basic functionality - { - std::thread t0(f0); - std::thread t1(f0); - t0.join(); - t1.join(); - assert(init0_called == 1); - } - // check basic exception safety - { - std::thread t0(f3); - std::thread t1(f3); - t0.join(); - t1.join(); - assert(init3_called == 2); - assert(init3_completed == 1); - } - // check deadlock avoidance - { - std::thread t0(f41); - std::thread t1(f42); - t0.join(); - t1.join(); - assert(init41_called == 1); - assert(init42_called == 1); - } -#ifndef _LIBCPP_HAS_NO_VARIADICS - // check functors with 1 arg - { - std::thread t0(f1); - std::thread t1(f1); - t0.join(); - t1.join(); - assert(init1::called == 1); - } - // check functors with 2 args - { - std::thread t0(f2); - std::thread t1(f2); - t0.join(); - t1.join(); - assert(init2::called == 5); - } -#endif // _LIBCPP_HAS_NO_VARIADICS -} diff --git a/test/thread/thread.mutex/thread.once/thread.once.onceflag/assign.fail.cpp b/test/thread/thread.mutex/thread.once/thread.once.onceflag/assign.fail.cpp deleted file mode 100644 index c4714276..00000000 --- a/test/thread/thread.mutex/thread.once/thread.once.onceflag/assign.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// struct once_flag; - -// once_flag& operator=(const once_flag&) = delete; - -#include - -int main() -{ - std::once_flag f; - std::once_flag f2; - f2 = f; -} diff --git a/test/thread/thread.mutex/thread.once/thread.once.onceflag/copy.fail.cpp b/test/thread/thread.mutex/thread.once/thread.once.onceflag/copy.fail.cpp deleted file mode 100644 index 450ba836..00000000 --- a/test/thread/thread.mutex/thread.once/thread.once.onceflag/copy.fail.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// struct once_flag; - -// once_flag(const once_flag&) = delete; - -#include - -int main() -{ - std::once_flag f; - std::once_flag f2(f); -} diff --git a/test/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp b/test/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp deleted file mode 100644 index dc4a0740..00000000 --- a/test/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// struct once_flag; - -// constexpr once_flag(); - -#include - -int main() -{ - std::once_flag f; -} diff --git a/test/thread/thread.mutex/version.pass.cpp b/test/thread/thread.mutex/version.pass.cpp deleted file mode 100644 index 81b52c79..00000000 --- a/test/thread/thread.mutex/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -} diff --git a/test/thread/thread.req/nothing_to_do.pass.cpp b/test/thread/thread.req/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.exception/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.exception/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.exception/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.lockable/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.lockable/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.lockable/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.basic/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.lockable/thread.req.lockable.basic/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.basic/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.general/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.lockable/thread.req.lockable.general/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.general/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.req/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.lockable/thread.req.lockable.req/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.req/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.timed/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.lockable/thread.req.lockable.timed/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.lockable/thread.req.lockable.timed/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55..00000000 --- a/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp deleted file mode 100644 index 4db3a1b3..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// void swap(thread& x, thread& y); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0((G())); - std::thread::id id0 = t0.get_id(); - std::thread t1; - std::thread::id id1 = t1.get_id(); - swap(t0, t1); - assert(t0.get_id() == id1); - assert(t1.get_id() == id0); - t1.join(); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp deleted file mode 100644 index 246488e5..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// thread& operator=(thread&& t); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } - -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0(G()); - std::thread t1; - t1 = t0; - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp deleted file mode 100644 index 7e35652b..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// thread& operator=(thread&& t); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } - - void operator()(int i, double j) - { - assert(alive_ == 1); - assert(n_alive == 1); - assert(i == 5); - assert(j == 5.5); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -void f1() -{ - std::exit(0); -} - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::set_terminate(f1); - { - assert(G::n_alive == 0); - assert(!G::op_run); - std::thread t0(G(), 5, 5.5); - std::thread::id id = t0.get_id(); - std::thread t1; - t1 = std::move(t0); - assert(t1.get_id() == id); - assert(t0.get_id() == std::thread::id()); - t1.join(); - assert(G::n_alive == 0); - assert(G::op_run); - } - { - std::thread t0(G(), 5, 5.5); - std::thread::id id = t0.get_id(); - std::thread t1; - t0 = std::move(t1); - assert(false); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp deleted file mode 100644 index f41a70b9..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp +++ /dev/null @@ -1,130 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// template thread(F&& f, Args&&... args); - -#include -#include -#include -#include - -unsigned throw_one = 0xFFFF; - -void* operator new(std::size_t s) throw(std::bad_alloc) -{ - if (throw_one == 0) - throw std::bad_alloc(); - --throw_one; - return std::malloc(s); -} - -void operator delete(void* p) throw() -{ - std::free(p); -} - -bool f_run = false; - -void f() -{ - f_run = true; -} - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive >= 1); - op_run = true; - } - - void operator()(int i, double j) - { - assert(alive_ == 1); - assert(n_alive >= 1); - assert(i == 5); - assert(j == 5.5); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t(f); - t.join(); - assert(f_run == true); - } - f_run = false; - { - try - { - throw_one = 0; - std::thread t(f); - assert(false); - } - catch (...) - { - throw_one = 0xFFFF; - assert(!f_run); - } - } - { - assert(G::n_alive == 0); - assert(!G::op_run); - std::thread t((G())); - t.join(); - assert(G::n_alive == 0); - assert(G::op_run); - } - G::op_run = false; - { - try - { - throw_one = 0; - assert(G::n_alive == 0); - assert(!G::op_run); - std::thread t((G())); - assert(false); - } - catch (...) - { - throw_one = 0xFFFF; - assert(G::n_alive == 0); - assert(!G::op_run); - } - } -#ifndef _LIBCPP_HAS_NO_VARIADICS - { - assert(G::n_alive == 0); - assert(!G::op_run); - std::thread t(G(), 5, 5.5); - t.join(); - assert(G::n_alive == 0); - assert(G::op_run); - } -#endif // _LIBCPP_HAS_NO_VARIADICS -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp deleted file mode 100644 index afba0f7e..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// thread(const thread&) = delete; - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } - - void operator()(int i, double j) - { - assert(alive_ == 1); - assert(n_alive == 1); - assert(i == 5); - assert(j == 5.5); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - assert(G::n_alive == 0); - assert(!G::op_run); - std::thread t0(G(), 5, 5.5); - std::thread::id id = t0.get_id(); - std::thread t1 = t0; - assert(t1.get_id() == id); - assert(t0.get_id() == std::thread::id()); - t1.join(); - assert(G::n_alive == 0); - assert(G::op_run); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp deleted file mode 100644 index cd9c2c40..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// thread(); - -#include -#include - -int main() -{ - std::thread t; - assert(t.get_id() == std::thread::id()); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp deleted file mode 100644 index 3d92b594..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// thread(thread&& t); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } - - void operator()(int i, double j) - { - assert(alive_ == 1); - assert(n_alive == 1); - assert(i == 5); - assert(j == 5.5); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - assert(G::n_alive == 0); - assert(!G::op_run); - std::thread t0(G(), 5, 5.5); - std::thread::id id = t0.get_id(); - std::thread t1 = std::move(t0); - assert(t1.get_id() == id); - assert(t0.get_id() == std::thread::id()); - t1.join(); - assert(G::n_alive == 0); - assert(G::op_run); - } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp deleted file mode 100644 index dfd8f57c..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// ~thread(); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -void f1() -{ - std::exit(0); -} - -int main() -{ - std::set_terminate(f1); - { - assert(G::n_alive == 0); - assert(!G::op_run); - std::thread t((G())); - std::this_thread::sleep_for(std::chrono::milliseconds(250)); - } - assert(false); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp deleted file mode 100644 index b8727d0a..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread::id - -// id& operator=(const id&) = default; - -#include -#include - -int main() -{ - std::thread::id id0; - std::thread::id id1; - id1 = id0; - assert(id1 == id0); - id1 = std::this_thread::get_id(); - assert(id1 != id0); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp deleted file mode 100644 index 6d17dfcb..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp +++ /dev/null @@ -1,24 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread::id - -// id(const id&) = default; - -#include -#include - -int main() -{ - std::thread::id id0; - std::thread::id id1 = id0; - assert(id1 == id0); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp deleted file mode 100644 index b315473b..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread::id - -// id(); - -#include -#include - -int main() -{ - std::thread::id id; - assert(id == std::thread::id()); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp deleted file mode 100644 index 2ff273c1..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread::id - -// bool operator==(thread::id x, thread::id y); -// bool operator!=(thread::id x, thread::id y); - -#include -#include - -int main() -{ - std::thread::id id0; - std::thread::id id1; - id1 = id0; - assert( (id1 == id0)); - assert(!(id1 != id0)); - id1 = std::this_thread::get_id(); - assert(!(id1 == id0)); - assert( (id1 != id0)); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp deleted file mode 100644 index 6a41f8a6..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread::id - -// bool operator< (thread::id x, thread::id y); -// bool operator<=(thread::id x, thread::id y); -// bool operator> (thread::id x, thread::id y); -// bool operator>=(thread::id x, thread::id y); - -#include -#include - -int main() -{ - std::thread::id id0; - std::thread::id id1; - std::thread::id id2 = std::this_thread::get_id(); - assert(!(id0 < id1)); - assert( (id0 <= id1)); - assert(!(id0 > id1)); - assert( (id0 >= id1)); - assert( (id0 < id2)); - assert( (id0 <= id2)); - assert(!(id0 > id2)); - assert(!(id0 >= id2)); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp deleted file mode 100644 index 54fc7391..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread::id - -// template -// basic_ostream& -// operator<<(basic_ostream& out, thread::id id); - -#include -#include -#include - -int main() -{ - std::thread::id id0 = std::this_thread::get_id(); - std::ostringstream os; - os << id0; -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp deleted file mode 100644 index d407dfc5..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// struct hash -// : public unary_function -// { -// size_t operator()(T val) const; -// }; - -// Not very portable - -#include -#include - -int main() -{ - std::thread::id id1; - std::thread::id id2 = std::this_thread::get_id(); - typedef std::hash H; - H h; - assert(h(id1) != h(id2)); -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp deleted file mode 100644 index c1391cbd..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// void detach(); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0((G())); - assert(t0.joinable()); - t0.detach(); - assert(!t0.joinable()); - std::this_thread::sleep_for(std::chrono::milliseconds(250)); - assert(G::op_run); - assert(G::n_alive == 0); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp deleted file mode 100644 index d086fb63..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// id get_id() const; - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0((G())); - std::thread::id id0 = t0.get_id(); - std::thread t1; - std::thread::id id1 = t1.get_id(); - assert(t0.get_id() != id1); - assert(t1.get_id() == std::thread::id()); - t0.join(); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp deleted file mode 100644 index 3b278da1..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// void join(); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0((G())); - assert(t0.joinable()); - t0.join(); - assert(!t0.joinable()); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp deleted file mode 100644 index 1cae60c3..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// bool joinable() const; - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0((G())); - assert(t0.joinable()); - t0.join(); - assert(!t0.joinable()); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp deleted file mode 100644 index 8feded79..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// native_handle_type native_handle(); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0((G())); - pthread_t pid = t0.native_handle(); - assert(pid != 0); - t0.join(); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp deleted file mode 100644 index 46bccd6e..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// void swap(thread& t); - -#include -#include -#include -#include - -class G -{ - int alive_; -public: - static int n_alive; - static bool op_run; - - G() : alive_(1) {++n_alive;} - G(const G& g) : alive_(g.alive_) {++n_alive;} - ~G() {alive_ = 0; --n_alive;} - - void operator()() - { - assert(alive_ == 1); - assert(n_alive == 1); - op_run = true; - } -}; - -int G::n_alive = 0; -bool G::op_run = false; - -int main() -{ - { - std::thread t0((G())); - std::thread::id id0 = t0.get_id(); - std::thread t1; - std::thread::id id1 = t1.get_id(); - t0.swap(t1); - assert(t0.get_id() == id1); - assert(t1.get_id() == id0); - t1.join(); - } -} diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.xfail.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.xfail.pass.cpp deleted file mode 100644 index 256edc27..00000000 --- a/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.xfail.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread - -// unsigned hardware_concurrency(); - -#include -#include - -int main() -{ - assert(std::thread::hardware_concurrency() > 0); -} diff --git a/test/thread/thread.threads/thread.thread.class/types.pass.cpp b/test/thread/thread.threads/thread.thread.class/types.pass.cpp deleted file mode 100644 index e5094f7d..00000000 --- a/test/thread/thread.threads/thread.thread.class/types.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// class thread -// { -// public: -// typedef pthread_t native_handle_type; -// ... -// }; - -#include -#include - -int main() -{ - static_assert((std::is_same::value), ""); -} diff --git a/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp b/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp deleted file mode 100644 index ef6615b3..00000000 --- a/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// thread::id this_thread::get_id(); - -#include -#include - -int main() -{ - std::thread::id id = std::this_thread::get_id(); - assert(id != std::thread::id()); -} diff --git a/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp deleted file mode 100644 index 2d5b4ac4..00000000 --- a/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// void sleep_for(const chrono::duration& rel_time); - -#include -#include -#include - -int main() -{ - typedef std::chrono::system_clock Clock; - typedef Clock::time_point time_point; - typedef Clock::duration duration; - std::chrono::milliseconds ms(500); - time_point t0 = Clock::now(); - std::this_thread::sleep_for(ms); - time_point t1 = Clock::now(); - std::chrono::nanoseconds ns = (t1 - t0) - ms; - std::chrono::nanoseconds err = ms / 100; - // The time slept is within 1% of 500ms - assert(std::abs(ns.count()) < err.count()); -} diff --git a/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp b/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp deleted file mode 100644 index c0bf087c..00000000 --- a/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// void sleep_until(const chrono::time_point& abs_time); - -#include -#include -#include - -int main() -{ - typedef std::chrono::system_clock Clock; - typedef Clock::time_point time_point; - typedef Clock::duration duration; - std::chrono::milliseconds ms(500); - time_point t0 = Clock::now(); - std::this_thread::sleep_until(t0 + ms); - time_point t1 = Clock::now(); - std::chrono::nanoseconds ns = (t1 - t0) - ms; - std::chrono::nanoseconds err = ms / 100; - // The time slept is within 1% of 500ms - assert(std::abs(ns.count()) < err.count()); -} diff --git a/test/thread/thread.threads/thread.thread.this/yield.pass.cpp b/test/thread/thread.threads/thread.thread.this/yield.pass.cpp deleted file mode 100644 index 52f53a6a..00000000 --- a/test/thread/thread.threads/thread.thread.this/yield.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// void this_thread::yield(); - -#include -#include - -int main() -{ - std::this_thread::yield(); -} diff --git a/test/thread/thread.threads/version.pass.cpp b/test/thread/thread.threads/version.pass.cpp deleted file mode 100644 index 6d272c79..00000000 --- a/test/thread/thread.threads/version.pass.cpp +++ /dev/null @@ -1,20 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -#include - -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION not defined -#endif - -int main() -{ -}