Fix for google-default-arguments

pull/24517/head
Esun Kim 4 years ago
parent eab203724a
commit eb18b1d27e
  1. 4
      src/core/lib/iomgr/executor/mpmcqueue.h
  2. 12
      test/core/iomgr/mpmcqueue_test.cc

@ -42,7 +42,7 @@ class MPMCQueueInterface {
// Removes the oldest element from the queue and return it.
// This might cause to block on empty queue depending on implementation.
// Optional argument for collecting stats purpose.
virtual void* Get(gpr_timespec* wait_time = nullptr) = 0;
virtual void* Get(gpr_timespec* wait_time) = 0;
// Returns number of elements in the queue currently
virtual int count() const = 0;
@ -65,7 +65,7 @@ class InfLenFIFOQueue : public MPMCQueueInterface {
// This routine will cause the thread to block if queue is currently empty.
// Argument wait_time should be passed in when trace flag turning on (for
// collecting stats info purpose.)
void* Get(gpr_timespec* wait_time = nullptr) override;
void* Get(gpr_timespec* wait_time) override;
// Returns number of elements in queue currently.
// There might be concurrently add/remove on queue, so count might change

@ -93,7 +93,7 @@ class ConsumerThread {
int count = 0;
WorkItem* item;
while ((item = static_cast<WorkItem*>(queue_->Get())) != nullptr) {
while ((item = static_cast<WorkItem*>(queue_->Get(nullptr))) != nullptr) {
count++;
GPR_ASSERT(!item->done);
item->done = true;
@ -113,7 +113,7 @@ static void test_FIFO(void) {
}
GPR_ASSERT(large_queue.count() == TEST_NUM_ITEMS);
for (int i = 0; i < TEST_NUM_ITEMS; ++i) {
WorkItem* item = static_cast<WorkItem*>(large_queue.Get());
WorkItem* item = static_cast<WorkItem*>(large_queue.Get(nullptr));
GPR_ASSERT(i == item->index);
delete item;
}
@ -130,12 +130,12 @@ static void test_space_efficiency(void) {
// Queue should not have been expanded at this time.
GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes());
for (int i = 0; i < queue.init_num_nodes(); ++i) {
WorkItem* item = static_cast<WorkItem*>(queue.Get());
WorkItem* item = static_cast<WorkItem*>(queue.Get(nullptr));
queue.Put(item);
}
GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes());
for (int i = 0; i < queue.init_num_nodes(); ++i) {
WorkItem* item = static_cast<WorkItem*>(queue.Get());
WorkItem* item = static_cast<WorkItem*>(queue.Get(nullptr));
delete item;
}
// Queue never shrinks even it is empty.
@ -149,7 +149,7 @@ static void test_space_efficiency(void) {
// Queue should have been expanded once.
GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 2);
for (int i = 0; i < queue.init_num_nodes(); ++i) {
WorkItem* item = static_cast<WorkItem*>(queue.Get());
WorkItem* item = static_cast<WorkItem*>(queue.Get(nullptr));
delete item;
}
GPR_ASSERT(queue.count() == queue.init_num_nodes());
@ -162,7 +162,7 @@ static void test_space_efficiency(void) {
// Queue should have been expanded twice.
GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 4);
for (int i = 0; i < queue.init_num_nodes() * 2 + 1; ++i) {
WorkItem* item = static_cast<WorkItem*>(queue.Get());
WorkItem* item = static_cast<WorkItem*>(queue.Get(nullptr));
delete item;
}
GPR_ASSERT(queue.count() == 0);

Loading…
Cancel
Save