summaryrefslogtreecommitdiff
path: root/src/include/thread_group.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/thread_group.h')
-rw-r--r--src/include/thread_group.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/include/thread_group.h b/src/include/thread_group.h
index 77cff00dc8d..7375f9dfd87 100644
--- a/src/include/thread_group.h
+++ b/src/include/thread_group.h
@@ -1,11 +1,13 @@
/*-
- * Copyright (c) 2014-2016 MongoDB, Inc.
+ * Copyright (c) 2014-2017 MongoDB, Inc.
* Copyright (c) 2008-2014 WiredTiger, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
*/
+#define WT_THREAD_PAUSE 10 /* Thread pause timeout in seconds */
+
/*
* WT_THREAD --
* Encapsulation of a thread that belongs to a thread group.
@@ -19,13 +21,24 @@ struct __wt_thread {
* WT_THREAD and thread-group function flags, merged because
* WT_THREAD_PANIC_FAIL appears in both groups.
*/
-#define WT_THREAD_CAN_WAIT 0x01 /* WT_SESSION_CAN_WAIT */
-#define WT_THREAD_PANIC_FAIL 0x02 /* panic if the thread fails */
-#define WT_THREAD_RUN 0x04 /* thread is running */
+#define WT_THREAD_ACTIVE 0x01 /* thread is active or paused */
+#define WT_THREAD_CAN_WAIT 0x02 /* WT_SESSION_CAN_WAIT */
+#define WT_THREAD_PANIC_FAIL 0x04 /* panic if the thread fails */
+#define WT_THREAD_RUN 0x08 /* thread is running */
uint32_t flags;
+ /*
+ * Condition signalled when a thread becomes active. Paused
+ * threads wait on this condition.
+ */
+ WT_CONDVAR *pause_cond;
+
+ /* The check function used by all threads. */
+ bool (*chk_func)(WT_SESSION_IMPL *session);
/* The runner function used by all threads. */
int (*run_func)(WT_SESSION_IMPL *session, WT_THREAD *context);
+ /* The stop function used by all threads. */
+ int (*stop_func)(WT_SESSION_IMPL *session, WT_THREAD *context);
};
/*
@@ -57,6 +70,10 @@ struct __wt_thread_group {
*/
WT_THREAD **threads;
+ /* The check function used by all threads. */
+ bool (*chk_func)(WT_SESSION_IMPL *session);
/* The runner function used by all threads. */
int (*run_func)(WT_SESSION_IMPL *session, WT_THREAD *context);
+ /* The stop function used by all threads. May be NULL */
+ int (*stop_func)(WT_SESSION_IMPL *session, WT_THREAD *context);
};