aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/executor.cc
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2017-11-06 12:36:46 -0800
committerGravatar GitHub <noreply@github.com>2017-11-06 12:36:46 -0800
commite759d2ad7abdb0702970eeccc5f033ff4b2a4c7f (patch)
treeb958e8ecb8856bdd1cf7fbfe35c98a0873b130fd /src/core/lib/iomgr/executor.cc
parent4f22c919e1207af206fc83e7378f04e047f7c78d (diff)
parent34992a63e0def16262d7fc9cac10ab527ac8eaa6 (diff)
Merge pull request #13255 from ctiller/50
Update clang-format to 5.0
Diffstat (limited to 'src/core/lib/iomgr/executor.cc')
-rw-r--r--src/core/lib/iomgr/executor.cc42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/core/lib/iomgr/executor.cc b/src/core/lib/iomgr/executor.cc
index 92c3e70301..2786492494 100644
--- a/src/core/lib/iomgr/executor.cc
+++ b/src/core/lib/iomgr/executor.cc
@@ -44,7 +44,7 @@ typedef struct {
gpr_thd_id id;
} thread_state;
-static thread_state *g_thread_state;
+static thread_state* g_thread_state;
static size_t g_max_threads;
static gpr_atm g_cur_threads;
static gpr_spinlock g_adding_thread_lock = GPR_SPINLOCK_STATIC_INITIALIZER;
@@ -54,15 +54,15 @@ GPR_TLS_DECL(g_this_thread_state);
static grpc_tracer_flag executor_trace =
GRPC_TRACER_INITIALIZER(false, "executor");
-static void executor_thread(void *arg);
+static void executor_thread(void* arg);
-static size_t run_closures(grpc_exec_ctx *exec_ctx, grpc_closure_list list) {
+static size_t run_closures(grpc_exec_ctx* exec_ctx, grpc_closure_list list) {
size_t n = 0;
- grpc_closure *c = list.head;
+ grpc_closure* c = list.head;
while (c != NULL) {
- grpc_closure *next = c->next_data.next;
- grpc_error *error = c->error_data.error;
+ grpc_closure* next = c->next_data.next;
+ grpc_error* error = c->error_data.error;
if (GRPC_TRACER_ON(executor_trace)) {
#ifndef NDEBUG
gpr_log(GPR_DEBUG, "EXECUTOR: run %p [created by %s:%d]", c,
@@ -88,7 +88,7 @@ bool grpc_executor_is_threaded() {
return gpr_atm_no_barrier_load(&g_cur_threads) > 0;
}
-void grpc_executor_set_threading(grpc_exec_ctx *exec_ctx, bool threading) {
+void grpc_executor_set_threading(grpc_exec_ctx* exec_ctx, bool threading) {
gpr_atm cur_threads = gpr_atm_no_barrier_load(&g_cur_threads);
if (threading) {
if (cur_threads > 0) return;
@@ -96,7 +96,7 @@ void grpc_executor_set_threading(grpc_exec_ctx *exec_ctx, bool threading) {
gpr_atm_no_barrier_store(&g_cur_threads, 1);
gpr_tls_init(&g_this_thread_state);
g_thread_state =
- (thread_state *)gpr_zalloc(sizeof(thread_state) * g_max_threads);
+ (thread_state*)gpr_zalloc(sizeof(thread_state) * g_max_threads);
for (size_t i = 0; i < g_max_threads; i++) {
gpr_mu_init(&g_thread_state[i].mu);
gpr_cv_init(&g_thread_state[i].cv);
@@ -133,18 +133,18 @@ void grpc_executor_set_threading(grpc_exec_ctx *exec_ctx, bool threading) {
}
}
-void grpc_executor_init(grpc_exec_ctx *exec_ctx) {
+void grpc_executor_init(grpc_exec_ctx* exec_ctx) {
grpc_register_tracer(&executor_trace);
gpr_atm_no_barrier_store(&g_cur_threads, 0);
grpc_executor_set_threading(exec_ctx, true);
}
-void grpc_executor_shutdown(grpc_exec_ctx *exec_ctx) {
+void grpc_executor_shutdown(grpc_exec_ctx* exec_ctx) {
grpc_executor_set_threading(exec_ctx, false);
}
-static void executor_thread(void *arg) {
- thread_state *ts = (thread_state *)arg;
+static void executor_thread(void* arg) {
+ thread_state* ts = (thread_state*)arg;
gpr_tls_set(&g_this_thread_state, (intptr_t)ts);
grpc_exec_ctx exec_ctx =
@@ -184,8 +184,8 @@ static void executor_thread(void *arg) {
grpc_exec_ctx_finish(&exec_ctx);
}
-static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
- grpc_error *error, bool is_short) {
+static void executor_push(grpc_exec_ctx* exec_ctx, grpc_closure* closure,
+ grpc_error* error, bool is_short) {
bool retry_push;
if (is_short) {
GRPC_STATS_INC_EXECUTOR_SCHEDULED_SHORT_ITEMS(exec_ctx);
@@ -207,13 +207,13 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
grpc_closure_list_append(&exec_ctx->closure_list, closure, error);
return;
}
- thread_state *ts = (thread_state *)gpr_tls_get(&g_this_thread_state);
+ thread_state* ts = (thread_state*)gpr_tls_get(&g_this_thread_state);
if (ts == NULL) {
ts = &g_thread_state[GPR_HASH_POINTER(exec_ctx, cur_thread_count)];
} else {
GRPC_STATS_INC_EXECUTOR_SCHEDULED_TO_SELF(exec_ctx);
}
- thread_state *orig_ts = ts;
+ thread_state* orig_ts = ts;
bool try_new_thread;
for (;;) {
@@ -276,13 +276,13 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
} while (retry_push);
}
-static void executor_push_short(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
- grpc_error *error) {
+static void executor_push_short(grpc_exec_ctx* exec_ctx, grpc_closure* closure,
+ grpc_error* error) {
executor_push(exec_ctx, closure, error, true);
}
-static void executor_push_long(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
- grpc_error *error) {
+static void executor_push_long(grpc_exec_ctx* exec_ctx, grpc_closure* closure,
+ grpc_error* error) {
executor_push(exec_ctx, closure, error, false);
}
@@ -295,7 +295,7 @@ static const grpc_closure_scheduler_vtable executor_vtable_long = {
executor_push_long, executor_push_long, "executor"};
static grpc_closure_scheduler executor_scheduler_long = {&executor_vtable_long};
-grpc_closure_scheduler *grpc_executor_scheduler(
+grpc_closure_scheduler* grpc_executor_scheduler(
grpc_executor_job_length length) {
return length == GRPC_EXECUTOR_SHORT ? &executor_scheduler_short
: &executor_scheduler_long;