Reviewer comments

pull/21275/head
Yash Tibrewal 5 years ago
parent cce1f5a060
commit 71d2895005
  1. 12
      src/core/lib/iomgr/logical_thread.cc
  2. 15
      test/core/iomgr/logical_thread_test.cc

@ -75,7 +75,7 @@ void LogicalThread::DrainQueue() {
GPR_DEBUG_ASSERT(prev_size >= 1);
if (prev_size == 1) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_logical_thread_trace)) {
gpr_log(GPR_INFO, " Queue Drained");
gpr_log(GPR_INFO, " Queue Drained");
}
break;
}
@ -88,16 +88,14 @@ void LogicalThread::DrainQueue() {
// This can happen either due to a race condition within the mpscq
// implementation or because of a race with Run()
if (GRPC_TRACE_FLAG_ENABLED(grpc_logical_thread_trace)) {
gpr_log(GPR_INFO, " Queue returned nullptr, trying again");
gpr_log(GPR_INFO, " Queue returned nullptr, trying again");
}
}
#ifndef NDEBUG
if (GRPC_TRACE_FLAG_ENABLED(grpc_logical_thread_trace)) {
gpr_log(GPR_INFO,
" Running item %p : callback scheduled at [%s:%d]", cb_wrapper,
cb_wrapper->location.file(), cb_wrapper->location.line());
gpr_log(GPR_INFO, " Running item %p : callback scheduled at [%s:%d]",
cb_wrapper, cb_wrapper->location.file(),
cb_wrapper->location.line());
}
#endif
cb_wrapper->callback();
delete cb_wrapper;
}

@ -43,17 +43,6 @@ TEST(LogicalThreadTest, ExecuteOne) {
nullptr);
}
struct ThreadArgs {
size_t counter;
grpc_core::RefCountedPtr<grpc_core::LogicalThread> lock;
gpr_event done;
};
struct ExecutionArgs {
size_t* counter;
size_t value;
};
class TestThread {
public:
explicit TestThread(grpc_core::RefCountedPtr<grpc_core::LogicalThread> lock)
@ -75,6 +64,10 @@ class TestThread {
size_t n = 1;
for (size_t i = 0; i < 10; i++) {
for (size_t j = 0; j < 10000; j++) {
struct ExecutionArgs {
size_t* counter;
size_t value;
};
ExecutionArgs* c = new ExecutionArgs;
c->counter = &self->counter_;
c->value = n++;

Loading…
Cancel
Save