4 #include "llvm/Support/Error.h" 5 #include "gmock/gmock.h" 6 #include "gtest/gtest.h" 15 TEST(CancellationTest, CancellationTest) {
17 WithContext ContextWithCancellation(std::move(Task.first));
23 TEST(CancellationTest, CancelerDiesContextLives) {
24 llvm::Optional<WithContext> ContextWithCancellation;
27 ContextWithCancellation.emplace(std::move(Task.first));
35 TEST(CancellationTest, TaskContextDiesHandleLives) {
38 WithContext ContextWithCancellation(std::move(Task.first));
47 TEST(CancellationTest, AsynCancellationTest) {
48 std::atomic<bool> HasCancelled(
false);
49 Notification Cancelled;
50 auto TaskToBeCancelled = [&](Context
Ctx) {
51 WithContext ContextGuard(std::move(
Ctx));
56 std::thread AsyncTask(TaskToBeCancelled, std::move(Task.first));
61 EXPECT_TRUE(HasCancelled);
bool isCancelled(const Context &Ctx)
True if the current context is within a cancelable task which was cancelled.
TEST(BackgroundQueueTest, Priority)
std::pair< Context, Canceler > cancelableTask()
Defines a new task whose cancellation may be requested.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//