diff options
| author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-04-14 03:25:28 +1000 |
|---|---|---|
| committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-04-14 03:25:28 +1000 |
| commit | f5c08e2b5f02805b062888d45c9eca19af175f7e (patch) | |
| tree | 0b43098fab6f6059c04c89e9b85337d5f625c5f2 /src/include/dhandle.h | |
| parent | d48181f6f4db08761ed7b80b0332908b272ad0d0 (diff) | |
| parent | cb16839cfbdf338af95bed43ca40979ae6e32f54 (diff) | |
Merge branch 'mongodb-3.4' into mongodb-3.2mongodb-3.2.13
Diffstat (limited to 'src/include/dhandle.h')
| -rw-r--r-- | src/include/dhandle.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/include/dhandle.h b/src/include/dhandle.h index d7802bb319b..8861e96112b 100644 --- a/src/include/dhandle.h +++ b/src/include/dhandle.h @@ -37,12 +37,30 @@ #define WT_SESSION_META_DHANDLE(s) \ (((WT_CURSOR_BTREE *)((s)->meta_cursor))->btree->dhandle) +#define WT_DHANDLE_ACQUIRE(dhandle) \ + (void)__wt_atomic_add32(&(dhandle)->session_ref, 1) + +#define WT_DHANDLE_RELEASE(dhandle) \ + (void)__wt_atomic_sub32(&(dhandle)->session_ref, 1) + +#define WT_DHANDLE_NEXT(session, dhandle, head, field) do { \ + WT_ASSERT(session, F_ISSET(session, WT_SESSION_LOCKED_HANDLE_LIST));\ + if ((dhandle) == NULL) \ + (dhandle) = TAILQ_FIRST(head); \ + else { \ + WT_DHANDLE_RELEASE(dhandle); \ + (dhandle) = TAILQ_NEXT(dhandle, field); \ + } \ + if ((dhandle) != NULL) \ + WT_DHANDLE_ACQUIRE(dhandle); \ +} while (0) + /* * WT_DATA_HANDLE -- * A handle for a generic named data source. */ struct __wt_data_handle { - WT_RWLOCK *rwlock; /* Lock for shared/exclusive ops */ + WT_RWLOCK rwlock; /* Lock for shared/exclusive ops */ TAILQ_ENTRY(__wt_data_handle) q; TAILQ_ENTRY(__wt_data_handle) hashq; |
