summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/task/task.basic/task_of_void.pass.cpp
diff options
context:
space:
mode:
authorBrian Gesiak <modocache@gmail.com>2019-03-26 19:50:46 +0000
committerBrian Gesiak <modocache@gmail.com>2019-03-26 19:50:46 +0000
commitb66754a29ed7a479e36fed89e0b45d10d5e71e71 (patch)
tree759fd580d95d431848d0c5f8176c77b7c5e6705d /libcxx/test/std/experimental/task/task.basic/task_of_void.pass.cpp
parent492f752969ff3a37138372e8e973317dc63ef2d3 (diff)
downloadbcm5719-llvm-b66754a29ed7a479e36fed89e0b45d10d5e71e71.tar.gz
bcm5719-llvm-b66754a29ed7a479e36fed89e0b45d10d5e71e71.zip
Revert "[coroutines] Add std::experimental::task<T> type"
This revision is causing build and test failures, such as http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv8-linux/builds/648/steps/test.libcxx/logs/stdio, so I'll revert it. llvm-svn: 357023
Diffstat (limited to 'libcxx/test/std/experimental/task/task.basic/task_of_void.pass.cpp')
-rw-r--r--libcxx/test/std/experimental/task/task.basic/task_of_void.pass.cpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/libcxx/test/std/experimental/task/task.basic/task_of_void.pass.cpp b/libcxx/test/std/experimental/task/task.basic/task_of_void.pass.cpp
deleted file mode 100644
index de860b5db6a..00000000000
--- a/libcxx/test/std/experimental/task/task.basic/task_of_void.pass.cpp
+++ /dev/null
@@ -1,96 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-
-#include <experimental/task>
-#include "../manual_reset_event.hpp"
-#include "../sync_wait.hpp"
-
-#include <optional>
-#include <thread>
-
-namespace coro = std::experimental::coroutines_v1;
-
-static bool has_f_executed = false;
-
-static coro::task<void> f()
-{
- has_f_executed = true;
- co_return;
-}
-
-static void test_coroutine_executes_lazily()
-{
- coro::task<void> t = f();
- assert(!has_f_executed);
- coro::sync_wait(t);
- assert(has_f_executed);
-}
-
-static std::optional<int> last_value_passed_to_g;
-
-static coro::task<void> g(int a)
-{
- last_value_passed_to_g = a;
- co_return;
-}
-
-void test_coroutine_accepts_arguments()
-{
- auto t = g(123);
- assert(!last_value_passed_to_g);
- coro::sync_wait(t);
- assert(last_value_passed_to_g);
- assert(*last_value_passed_to_g == 123);
-}
-
-int shared_value = 0;
-int read_value = 0;
-
-coro::task<void> consume_async(manual_reset_event& event)
-{
- co_await event;
- read_value = shared_value;
-}
-
-void produce(manual_reset_event& event)
-{
- shared_value = 101;
- event.set();
-}
-
-void test_async_completion()
-{
- manual_reset_event e;
- std::thread t1{ [&e]
- {
- sync_wait(consume_async(e));
- }};
-
- assert(read_value == 0);
-
- std::thread t2{ [&e] { produce(e); }};
-
- t1.join();
-
- assert(read_value == 101);
-
- t2.join();
-}
-
-int main()
-{
- test_coroutine_executes_lazily();
- test_coroutine_accepts_arguments();
- test_async_completion();
-
- return 0;
-}
OpenPOWER on IntegriCloud