From: Maged Michael Date: Sun, 17 Dec 2017 01:20:04 +0000 (-0800) Subject: Test UnboundedBlockingQueue in ThreadPoolExecutorTest X-Git-Tag: v2017.12.18.00~1 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9cb500221e2d70d8bdba2f368e4d438c97a48a9e;p=folly.git Test UnboundedBlockingQueue in ThreadPoolExecutorTest Summary: Test UnboundedBlockingQueue for the case in D3527722 Reviewed By: ot Differential Revision: D6587163 fbshipit-source-id: 1465991018187c5f841e6e3e7a11676390e2f8f2 --- diff --git a/folly/executors/test/ThreadPoolExecutorTest.cpp b/folly/executors/test/ThreadPoolExecutorTest.cpp index 3e9b68a2..a0fd9d12 100644 --- a/folly/executors/test/ThreadPoolExecutorTest.cpp +++ b/folly/executors/test/ThreadPoolExecutorTest.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -478,10 +479,11 @@ struct SlowMover { bool slow; }; -TEST(ThreadPoolExecutorTest, BugD3527722) { +template +void bugD3527722_test() { // Test that the queue does not get stuck if writes are completed in // order opposite to how they are initiated. - LifoSemMPMCQueue q(1024); + Q q(1024); std::atomic turn{}; std::thread consumer1([&] { @@ -515,6 +517,19 @@ TEST(ThreadPoolExecutorTest, BugD3527722) { consumer2.join(); } +TEST(ThreadPoolExecutorTest, LifoSemMPMCQueueBugD3527722) { + bugD3527722_test>(); +} + +template +struct UBQ : public UnboundedBlockingQueue { + explicit UBQ(int) {} +}; + +TEST(ThreadPoolExecutorTest, UnboundedBlockingQueueBugD3527722) { + bugD3527722_test>(); +} + template static void ShutdownTest() { // test that adding a .then() after we have