diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-12-14 23:42:38 -0500 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2016-12-15 15:42:38 +1100 |
commit | a026912444c9714011acfec0ca40722e3b55e2a1 (patch) | |
tree | f38cb9b72ddf6ccffa20204cd931520fa5d72492 | |
parent | baa27801547d12172bd1dd3ac4f18b3d308147ea (diff) | |
download | mongo-a026912444c9714011acfec0ca40722e3b55e2a1.tar.gz |
WT-3078 test reconfiguration hang in the statlog server. (#3198)
Flush the caller's flags before reading the condition information, we may not write anything before joining the exiting thread, and a write-barrier() would not necessarily have any effect.
-rw-r--r-- | src/os_posix/os_mtx_cond.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/os_posix/os_mtx_cond.c b/src/os_posix/os_mtx_cond.c index d4ee532a2af..be8b1abda31 100644 --- a/src/os_posix/os_mtx_cond.c +++ b/src/os_posix/os_mtx_cond.c @@ -107,10 +107,13 @@ __wt_cond_signal(WT_SESSION_IMPL *session, WT_CONDVAR *cond) __wt_verbose(session, WT_VERB_MUTEX, "signal %s", cond->name); /* - * Our callers are often setting flags to cause a thread to exit. Add - * a barrier to ensure the flags are seen by the threads. + * Our callers often set flags to cause a thread to exit. Add a barrier + * to ensure exit flags are seen by the sleeping threads, otherwise we + * can wake up a thread, it immediately goes back to sleep, and we'll + * hang. Use a full barrier (we may not write before waiting on thread + * join). */ - WT_WRITE_BARRIER(); + WT_FULL_BARRIER(); /* * Fast path if we are in (or can enter), a state where the next waiter |