Commit 8b84a96a authored by Kenton Varda's avatar Kenton Varda

Fix subtle race in test.

The delay() here isn't long enough on Cygwin when using pipes for wakeup. Apparently, Cygwin pipes are very slow. :/
parent 95648408
...@@ -512,16 +512,21 @@ KJ_TEST("cross-thread cancellation cycle") { ...@@ -512,16 +512,21 @@ KJ_TEST("cross-thread cancellation cycle") {
// Create an event that cycles through both threads and back to this one, and then cancel it. // Create an event that cycles through both threads and back to this one, and then cancel it.
bool cycleAllDestroyed = false; bool cycleAllDestroyed = false;
{ {
auto paf = kj::newPromiseAndFulfiller<void>();
Promise<uint> promise = exec1->executeAsync([&]() -> kj::Promise<uint> { Promise<uint> promise = exec1->executeAsync([&]() -> kj::Promise<uint> {
return exec2->executeAsync([&]() -> kj::Promise<uint> { return exec2->executeAsync([&]() -> kj::Promise<uint> {
return parentExecutor.executeAsync([&]() -> kj::Promise<uint> { return parentExecutor.executeAsync([&]() -> kj::Promise<uint> {
paf.fulfiller->fulfill();
return kj::Promise<uint>(kj::NEVER_DONE).attach(kj::defer([&]() { return kj::Promise<uint>(kj::NEVER_DONE).attach(kj::defer([&]() {
cycleAllDestroyed = true; cycleAllDestroyed = true;
})); }));
}); });
}); });
}); });
delay();
// Wait until the cycle has come all the way around.
paf.promise.wait(waitScope);
KJ_EXPECT(!promise.poll(waitScope)); KJ_EXPECT(!promise.poll(waitScope));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment