aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-10-15 22:33:18 +0000
committerGravatar Craig Tiller <ctiller@google.com>2017-10-15 22:33:18 +0000
commitd3f1f4340b4dfab27a2070761d256e488f8e7998 (patch)
tree0610d32d5f149b0acb01454c4120dd199e4ce59d /src/core/lib/iomgr
parent1f708a6adef0a34feeb8641c328ae05f1e81d461 (diff)
parent1e8c2ab769129b1d4e43cdbc1af89eb0082741fd (diff)
Merge branch 'epexinf' of github.com:ctiller/grpc into epexinf
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r--src/core/lib/iomgr/ev_epollex_linux.cc37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index 07ba9dd2cc..fc4c875df2 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -24,13 +24,13 @@
#include "src/core/lib/iomgr/ev_epollex_linux.h"
#include <assert.h>
-#include <sys/syscall.h>
#include <errno.h>
#include <limits.h>
#include <poll.h>
#include <pthread.h>
#include <string.h>
#include <sys/socket.h>
+#include <sys/syscall.h>
#include <unistd.h>
#include <grpc/support/alloc.h>
@@ -545,13 +545,16 @@ static void pollset_global_shutdown(void) {
static void pollset_maybe_finish_shutdown(grpc_exec_ctx *exec_ctx,
grpc_pollset *pollset) {
- if (pollset->shutdown_closure != NULL && pollset->root_worker == NULL && pollset->containing_pollset_set_count == 0) {
+ if (pollset->shutdown_closure != NULL && pollset->root_worker == NULL &&
+ pollset->containing_pollset_set_count == 0) {
GRPC_CLOSURE_SCHED(exec_ctx, pollset->shutdown_closure, GRPC_ERROR_NONE);
pollset->shutdown_closure = NULL;
}
}
-/* pollset->mu must be held before calling this function, pollset->active_pollable->mu & specific_worker->pollable_obj->mu must not be held */
+/* pollset->mu must be held before calling this function,
+ * pollset->active_pollable->mu & specific_worker->pollable_obj->mu must not be
+ * held */
static grpc_error *pollset_kick_one(grpc_exec_ctx *exec_ctx,
grpc_pollset *pollset,
grpc_pollset_worker *specific_worker) {
@@ -566,8 +569,7 @@ GRPC_STATS_INC_POLLSET_KICK(exec_ctx);
GRPC_STATS_INC_POLLSET_KICKED_AGAIN(exec_ctx);
return GRPC_ERROR_NONE;
}
- if (gpr_tls_get(&g_current_thread_worker) ==
- (intptr_t)specific_worker) {
+ if (gpr_tls_get(&g_current_thread_worker) == (intptr_t)specific_worker) {
if (GRPC_TRACER_ON(grpc_polling_trace)) {
gpr_log(GPR_DEBUG, "PS:%p kicked_specific_but_awake", p);
}
@@ -593,7 +595,8 @@ GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(exec_ctx);
gpr_cv_signal(&specific_worker->cv);
return GRPC_ERROR_NONE;
}
- // we can get here during end_worker after removing specific_worker from the pollable list but before removing it from the pollset list
+ // we can get here during end_worker after removing specific_worker from the
+ // pollable list but before removing it from the pollset list
return GRPC_ERROR_NONE;
}
@@ -887,7 +890,8 @@ static bool begin_worker(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
gpr_mu_unlock(&worker->pollable_obj->mu);
return do_poll;
-// && pollset->shutdown_closure == NULL && pollset->active_pollable == worker->pollable_obj;
+ // && pollset->shutdown_closure == NULL && pollset->active_pollable ==
+ // worker->pollable_obj;
}
static void end_worker(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
@@ -903,7 +907,8 @@ static void end_worker(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
gpr_mu_unlock(&worker->pollable_obj->mu);
POLLABLE_UNREF(worker->pollable_obj, "pollset_worker");
gpr_mu_lock(&pollset->mu);
- if (worker_remove(&pollset->root_worker, worker, PWLINK_POLLSET) == WRR_EMPTIED) {
+ if (worker_remove(&pollset->root_worker, worker, PWLINK_POLLSET) ==
+ WRR_EMPTIED) {
pollset_maybe_finish_shutdown(exec_ctx, pollset);
}
if (worker->initialized_cv) {
@@ -1045,8 +1050,8 @@ static grpc_error *pollset_add_fd_locked(grpc_exec_ctx *exec_ctx,
}
static grpc_error *pollset_as_multipollable_locked(grpc_exec_ctx *exec_ctx,
- grpc_pollset *pollset,
- pollable **pollable_obj) {
+ grpc_pollset *pollset,
+ pollable **pollable_obj) {
grpc_error *error = GRPC_ERROR_NONE;
pollable *po_at_start =
POLLABLE_REF(pollset->active_pollable, "pollset_as_multipollable");
@@ -1227,15 +1232,15 @@ static void pollset_set_add_pollset(grpc_exec_ctx *exec_ctx,
grpc_error *error = GRPC_ERROR_NONE;
static const char *err_desc = "pollset_set_add_pollset";
pollable *pollable_obj = NULL;
-gpr_mu_lock(&ps->mu);
- if (!GRPC_LOG_IF_ERROR(
- err_desc, pollset_as_multipollable_locked(exec_ctx, ps, &pollable_obj))) {
+ gpr_mu_lock(&ps->mu);
+ if (!GRPC_LOG_IF_ERROR(err_desc, pollset_as_multipollable_locked(
+ exec_ctx, ps, &pollable_obj))) {
GPR_ASSERT(pollable_obj == NULL);
-gpr_mu_unlock(&ps->mu);
+ gpr_mu_unlock(&ps->mu);
return;
}
-ps->containing_pollset_set_count++;
-gpr_mu_unlock(&ps->mu);
+ ps->containing_pollset_set_count++;
+ gpr_mu_unlock(&ps->mu);
pss = pss_lock_adam(pss);
size_t initial_fd_count = pss->fd_count;
pss->fd_count = 0;