summaryrefslogtreecommitdiff
path: root/src/include/dhandle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/dhandle.h')
-rw-r--r--src/include/dhandle.h20
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;