From 3ec57262161aafe4a5d0d1c0a52400016c97ce74 Mon Sep 17 00:00:00 2001 From: Yunjia Wang Date: Fri, 19 Jul 2019 10:57:28 -0700 Subject: [PATCH] Re-format --- src/core/lib/iomgr/executor/mpmcqueue.cc | 12 +++++------- src/core/lib/iomgr/executor/mpmcqueue.h | 10 +++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/core/lib/iomgr/executor/mpmcqueue.cc b/src/core/lib/iomgr/executor/mpmcqueue.cc index 7ef5cf40e14..15b2938a3ac 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.cc +++ b/src/core/lib/iomgr/executor/mpmcqueue.cc @@ -33,8 +33,8 @@ inline void* InfLenFIFOQueue::PopFront() { // Updates Stats when trace flag turned on. if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { - gpr_timespec wait_time = gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), - queue_head_->insert_time); + gpr_timespec wait_time = + gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), queue_head_->insert_time); stats_.num_completed++; stats_.total_queue_time = gpr_time_add(stats_.total_queue_time, wait_time); stats_.max_queue_time = gpr_time_max( @@ -103,7 +103,7 @@ void InfLenFIFOQueue::Put(void* elem) { int curr_count = count_.Load(MemoryOrder::RELAXED); - if (queue_tail_ == queue_head_ && curr_count!= 0) { + if (queue_tail_ == queue_head_ && curr_count != 0) { // List is full. Expands list to double size by inserting new chunk of nodes Node* new_chunk = AllocateNodes(curr_count); delete_list_[delete_list_count_++] = new_chunk; @@ -166,7 +166,7 @@ void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { size_t InfLenFIFOQueue::num_node() { size_t num = 1024; for (size_t i = 1; i < delete_list_count_; ++i) { - num = num* 2; + num = num * 2; } return num; } @@ -184,8 +184,6 @@ void InfLenFIFOQueue::RemoveWaiter(Waiter* waiter) { waiter->prev->next = waiter->next; } -InfLenFIFOQueue::Waiter* InfLenFIFOQueue::TopWaiter() { - return waiters_.next; -} +InfLenFIFOQueue::Waiter* InfLenFIFOQueue::TopWaiter() { return waiters_.next; } } // namespace grpc_core diff --git a/src/core/lib/iomgr/executor/mpmcqueue.h b/src/core/lib/iomgr/executor/mpmcqueue.h index 05e5a0a7579..49bebf8af4b 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.h +++ b/src/core/lib/iomgr/executor/mpmcqueue.h @@ -76,7 +76,7 @@ class InfLenFIFOQueue : public MPMCQueueInterface { int count() const { return count_.Load(MemoryOrder::RELAXED); } struct Node { - Node* next; // Linking + Node* next; // Linking Node* prev; void* content; // Points to actual element gpr_timespec insert_time; // Time for stats @@ -141,8 +141,8 @@ class InfLenFIFOQueue : public MPMCQueueInterface { // last added waiter. Waiter* TopWaiter(); - Mutex mu_; // Protecting lock - Waiter waiters_; // Head of waiting thread queue + Mutex mu_; // Protecting lock + Waiter waiters_; // Head of waiting thread queue Node** delete_list_ = nullptr; // Keeps track of all allocated array entries // for deleting on destruction @@ -154,8 +154,8 @@ class InfLenFIFOQueue : public MPMCQueueInterface { Node* queue_tail_ = nullptr; // End of queue, insert position Atomic count_{0}; // Number of elements in queue - Stats stats_; // Stats info - gpr_timespec busy_time; // Start time of busy queue + Stats stats_; // Stats info + gpr_timespec busy_time; // Start time of busy queue // Internal Helper. // Allocates an array of nodes of size "num", links all nodes together except