diff options
author | 2015-09-22 12:33:20 -0700 | |
---|---|---|
committer | 2015-09-22 12:33:20 -0700 | |
commit | a82950e68318a6aab6fe894fa39f7fa616c4647b (patch) | |
tree | 7d02bd1e9e1cbae1f14ad4ad1e06d3ae81a96dfe /test/core/iomgr/workqueue_test.c | |
parent | 8af4c337181322cc4fb396199c90f574cfb4163f (diff) |
clang-format all core files
Diffstat (limited to 'test/core/iomgr/workqueue_test.c')
-rw-r--r-- | test/core/iomgr/workqueue_test.c | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/test/core/iomgr/workqueue_test.c b/test/core/iomgr/workqueue_test.c index eadb080a41..a7394ae051 100644 --- a/test/core/iomgr/workqueue_test.c +++ b/test/core/iomgr/workqueue_test.c @@ -40,61 +40,54 @@ static grpc_pollset g_pollset; -static void -must_succeed (grpc_exec_ctx * exec_ctx, void *p, int success) -{ - GPR_ASSERT (success == 1); - gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset)); - *(int *) p = 1; - grpc_pollset_kick (&g_pollset, NULL); - gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset)); +static void must_succeed(grpc_exec_ctx *exec_ctx, void *p, int success) { + GPR_ASSERT(success == 1); + gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); + *(int *)p = 1; + grpc_pollset_kick(&g_pollset, NULL); + gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); } -static void -test_add_closure (void) -{ +static void test_add_closure(void) { grpc_closure c; int done = 0; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_workqueue *wq = grpc_workqueue_create (&closure_list); - gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE (5); + grpc_workqueue *wq = grpc_workqueue_create(&closure_list); + gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5); grpc_pollset_worker worker; - grpc_closure_init (&c, must_succeed, &done); + grpc_closure_init(&c, must_succeed, &done); - grpc_workqueue_push (wq, &c, 1); - grpc_workqueue_add_to_pollset (&exec_ctx, wq, &g_pollset); + grpc_workqueue_push(wq, &c, 1); + grpc_workqueue_add_to_pollset(&exec_ctx, wq, &g_pollset); - gpr_mu_lock (GRPC_POLLSET_MU (&g_pollset)); - GPR_ASSERT (!done); - grpc_pollset_work (&g_pollset, &worker, gpr_now (&exec_ctx, deadline.clock_type), deadline); - gpr_mu_unlock (GRPC_POLLSET_MU (&g_pollset)); - grpc_exec_ctx_finish (&exec_ctx); - GPR_ASSERT (done); + gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset)); + GPR_ASSERT(!done); + grpc_pollset_work(&g_pollset, &worker, + gpr_now(&exec_ctx, deadline.clock_type), deadline); + gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset)); + grpc_exec_ctx_finish(&exec_ctx); + GPR_ASSERT(done); - GRPC_WORKQUEUE_UNREF (&exec_ctx, wq, "destroy"); - grpc_exec_ctx_finish (&exec_ctx); + GRPC_WORKQUEUE_UNREF(&exec_ctx, wq, "destroy"); + grpc_exec_ctx_finish(&exec_ctx); } -static void -destroy_pollset (grpc_exec_ctx * exec_ctx, void *p, int success) -{ - grpc_pollset_destroy (p); +static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, int success) { + grpc_pollset_destroy(p); } -int -main (int argc, char **argv) -{ +int main(int argc, char **argv) { grpc_closure destroyed; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_test_init (argc, argv); - grpc_init (); - grpc_pollset_init (&g_pollset); + grpc_test_init(argc, argv); + grpc_init(); + grpc_pollset_init(&g_pollset); - test_add_closure (); + test_add_closure(); - grpc_closure_init (&destroyed, destroy_pollset, &g_pollset); - grpc_pollset_shutdown (&exec_ctx, &g_pollset, &destroyed); - grpc_exec_ctx_finish (&exec_ctx); - grpc_shutdown (); + grpc_closure_init(&destroyed, destroy_pollset, &g_pollset); + grpc_pollset_shutdown(&exec_ctx, &g_pollset, &destroyed); + grpc_exec_ctx_finish(&exec_ctx); + grpc_shutdown(); return 0; } |