summaryrefslogtreecommitdiff
path: root/src/mongo/util/fail_point.h
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-04-13 18:38:40 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-04-15 11:21:08 -0400
commit2b8ceb83a66eb400aa7dcad0a3735f2d6515b755 (patch)
tree4ae5dcc9e439f3c3d3ae51dcca5d5b02c1fddf5b /src/mongo/util/fail_point.h
parent0bf837ee16bd39df6a0e502286524553bc96c0f0 (diff)
downloadmongo-2b8ceb83a66eb400aa7dcad0a3735f2d6515b755.tar.gz
SERVER-23686 Handle race condition in ThreadPoolTaskExecutor shutdown logic.
Some implementations of NetworkInterface, particularly NetworkInterfaceMock, cannot be shut down before the ThreadPool used by the ThreadPoolTaskExecutor, leaving a race between shutting down the pool and scheduling the final completed network operations into the pool. The workaround is to let the ThreadPoolTaskExecutor's join() method execute any operation callbacks that get left behind in this scenario. The safety argument is described in a comment in the code.
Diffstat (limited to 'src/mongo/util/fail_point.h')
-rw-r--r--src/mongo/util/fail_point.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h
index 5cdc6bd5c0a..dad6ddef522 100644
--- a/src/mongo/util/fail_point.h
+++ b/src/mongo/util/fail_point.h
@@ -225,9 +225,11 @@ private:
#define MONGO_FAIL_POINT(symbol) MONGO_unlikely(symbol.shouldFail())
#define MONGO_FAIL_POINT_PAUSE_WHILE_SET(symbol) \
- while (MONGO_FAIL_POINT(symbol)) { \
- sleepmillis(100); \
- }
+ do { \
+ while (MONGO_FAIL_POINT(symbol)) { \
+ sleepmillis(100); \
+ } \
+ } while (false)
/**
* Macro for creating a fail point with block context. Also use this when