diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-05-30 11:53:52 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-05-30 11:53:52 -0400 |
commit | bb986cf4098647e529ea73d6ec1323d53fc86675 (patch) | |
tree | 7b89dde3bb77a904c2e9fc8b176de6c98b836f74 /src/include/session.h | |
parent | 532dea6aebf2b6a5ab3bc085e9df09919507731a (diff) | |
download | mongo-bb986cf4098647e529ea73d6ec1323d53fc86675.tar.gz |
Avoid read/write races in the PRNG: switch to using an 8B value instead
of a two, 4B value array, declare the value volatile to avoid having the
compiler alter the read/write path.
Add a check if a PRNG component ever goes to zero and reset it.
Diffstat (limited to 'src/include/session.h')
-rw-r--r-- | src/include/session.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/session.h b/src/include/session.h index 8a8b229dbc0..b9a55f924de 100644 --- a/src/include/session.h +++ b/src/include/session.h @@ -146,9 +146,9 @@ struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { * to clear everything but the fields that persist. */ #define WT_SESSION_CLEAR_SIZE(s) \ - (WT_PTRDIFF(&(s)->rnd[0], s)) + (WT_PTRDIFF(&(s)->rnd, s)) - uint32_t rnd[2]; /* Random number generation state */ + uint64_t rnd; /* Random number generation state */ /* Hashed handle reference list array */ SLIST_HEAD(__dhandles_hash, __wt_data_handle_cache) *dhhash; |