about summary refs log tree commit homepage
path: root/ioq.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-07-14 00:46:10 +0000
committerEric Wong <normalperson@yhbt.net>2013-07-14 00:46:10 +0000
commit8f9b7e28eaf74e5fdc72328f0dfb890d92c02ec1 (patch)
treecefa17156197096e9973efa6973d924fae737c6d /ioq.c
parentb773c55485a7a50904493a0cdc8dd22da9bbfdee (diff)
downloadcmogstored-8f9b7e28eaf74e5fdc72328f0dfb890d92c02ec1.tar.gz
This should avoid concurrency bugs where client may run in
multiple threads if we switch to multi-threaded graceful shutdown.
Diffstat (limited to 'ioq.c')
-rw-r--r--ioq.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ioq.c b/ioq.c
index 772da38..0000bb8 100644
--- a/ioq.c
+++ b/ioq.c
@@ -25,6 +25,18 @@ void mog_ioq_init(struct mog_ioq *ioq, struct mog_svc *svc, size_t val)
 }
 
 /*
+ * we do not need this, yet, but this will allow us to have multi-threaded
+ * shutdown in the future (we currently drop into single-threaded mode)
+ */
+void mog_ioq_requeue_prepare(struct mog_ioq *ioq)
+{
+        assert(ioq->cur >= ioq->max &&
+                "we should only get here when idle before mog_fdmap_requeue");
+
+        SIMPLEQ_INIT(&ioq->ioq_head);
+}
+
+/*
  * this is only a hint, so no explicit memory barriers or atomics
  */
 static inline void ioq_set_contended(struct mog_ioq *ioq)