summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2015-02-12 14:35:43 +1100
committerAlex Gorrod <alexander.gorrod@mongodb.com>2015-02-12 14:35:43 +1100
commitb196f751fb3990845a705886a0536f8ace720fdb (patch)
tree7680a9735b162d31dddd4d85f896c5ba7633ed0d
parent55a8ceb63de73af8dba47271e4d59bfae98c611c (diff)
parent04ec3d021d2f8b08b69d3ea5d0f243f468c71f2e (diff)
downloadmongo-b196f751fb3990845a705886a0536f8ace720fdb.tar.gz
Merge pull request #1673 from wiredtiger/server-threads-wait-first
Move server thread waits to the beginning of their loops
-rw-r--r--src/conn/conn_ckpt.c16
-rw-r--r--src/conn/conn_stat.c6
-rw-r--r--src/conn/conn_sweep.c1
3 files changed, 11 insertions, 12 deletions
diff --git a/src/conn/conn_ckpt.c b/src/conn/conn_ckpt.c
index f38628617dd..6eb134c1765 100644
--- a/src/conn/conn_ckpt.c
+++ b/src/conn/conn_ckpt.c
@@ -83,6 +83,14 @@ __ckpt_server(void *arg)
while (F_ISSET(conn, WT_CONN_SERVER_RUN) &&
F_ISSET(conn, WT_CONN_SERVER_CHECKPOINT)) {
+ /*
+ * Wait...
+ * NOTE: If the user only configured logsize, then usecs
+ * will be 0 and this wait won't return until signalled.
+ */
+ WT_ERR(
+ __wt_cond_wait(session, conn->ckpt_cond, conn->ckpt_usecs));
+
/* Checkpoint the database. */
WT_ERR(wt_session->checkpoint(wt_session, conn->ckpt_config));
@@ -99,14 +107,6 @@ __ckpt_server(void *arg)
*/
WT_ERR(__wt_cond_wait(session, conn->ckpt_cond, 1));
}
-
- /*
- * Wait...
- * NOTE: If the user only configured logsize, then usecs
- * will be 0 and this wait won't return until signalled.
- */
- WT_ERR(
- __wt_cond_wait(session, conn->ckpt_cond, conn->ckpt_usecs));
}
if (0) {
diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c
index 2d8395c0517..be2172ea8d8 100644
--- a/src/conn/conn_stat.c
+++ b/src/conn/conn_stat.c
@@ -406,12 +406,12 @@ __statlog_server(void *arg)
while (F_ISSET(conn, WT_CONN_SERVER_RUN) &&
F_ISSET(conn, WT_CONN_SERVER_STATISTICS)) {
- if (!FLD_ISSET(conn->stat_flags, WT_CONN_STAT_NONE))
- WT_ERR(__statlog_log_one(session, &path, &tmp));
-
/* Wait until the next event. */
WT_ERR(
__wt_cond_wait(session, conn->stat_cond, conn->stat_usecs));
+
+ if (!FLD_ISSET(conn->stat_flags, WT_CONN_STAT_NONE))
+ WT_ERR(__statlog_log_one(session, &path, &tmp));
}
if (0) {
diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c
index a5bd8e1343c..5145583fc7d 100644
--- a/src/conn/conn_sweep.c
+++ b/src/conn/conn_sweep.c
@@ -118,7 +118,6 @@ __sweep_server(void *arg)
*/
while (F_ISSET(conn, WT_CONN_SERVER_RUN) &&
F_ISSET(conn, WT_CONN_SERVER_SWEEP)) {
-
/* Wait until the next event. */
WT_ERR(__wt_cond_wait(session,
conn->sweep_cond, WT_DHANDLE_SWEEP_PERIOD * WT_MILLION));