summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/event-epoll.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2015-08-28 14:27:20 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2015-08-28 10:14:01 -0700
commitdedf2bde88020adbabb80204830878f060fa614c (patch)
treeb80e95e397e8fb2e396bfaa1bd8d7406d2c10171 /libglusterfs/src/event-epoll.c
parentbd9dd34700de63f96b9fc65125d539b2c16fa6bf (diff)
event-epoll: Use pollers[] to check if event_pool_dispatch was called
BUG: 1242421 Change-Id: I1a0044653f15d33f89ffe16edc5baba40393dec3 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/12004 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'libglusterfs/src/event-epoll.c')
-rw-r--r--libglusterfs/src/event-epoll.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libglusterfs/src/event-epoll.c b/libglusterfs/src/event-epoll.c
index dfa97cad368..78eff9398a6 100644
--- a/libglusterfs/src/event-epoll.c
+++ b/libglusterfs/src/event-epoll.c
@@ -765,6 +765,23 @@ event_dispatch_epoll (struct event_pool *event_pool)
return ret;
}
+/**
+ * @param event_pool event_pool on which fds of interest are registered for
+ * events.
+ *
+ * @return 1 if at least one epoll worker thread is spawned, 0 otherwise
+ *
+ * NB This function SHOULD be called under event_pool->mutex.
+ */
+
+static int
+event_pool_dispatched_unlocked (struct event_pool *event_pool)
+{
+ return (event_pool->pollers[0] != 0);
+
+}
+
+
int
event_reconfigure_threads_epoll (struct event_pool *event_pool, int value)
{
@@ -795,7 +812,8 @@ event_reconfigure_threads_epoll (struct event_pool *event_pool, int value)
* was called before. If event_dispatch() was not called, there
* will be no epoll 'worker' threads running yet. */
- if (event_pool->dispatched && oldthreadcount < value) {
+ if (event_pool_dispatched_unlocked(event_pool)
+ && (oldthreadcount < value)) {
/* create more poll threads */
for (i = oldthreadcount; i < value; i++) {
/* Start a thread if the index at this location