Fix build errors.

pull/21216/head
Guantao Liu 5 years ago
parent 683384cd5f
commit b3b155c256
  1. 2
      src/core/lib/iomgr/poller/eventmanager_libuv.cc
  2. 4
      src/core/lib/iomgr/poller/eventmanager_libuv.h
  3. 3
      test/core/iomgr/poller/eventmanager_libuv_test.cc

@ -27,7 +27,7 @@ grpc::experimental::LibuvEventManager::Options::Options(int num_workers)
: num_workers_(num_workers) {} : num_workers_(num_workers) {}
grpc::experimental::LibuvEventManager::LibuvEventManager(const Options& options) grpc::experimental::LibuvEventManager::LibuvEventManager(const Options& options)
: options_(options) { : options_(options), should_stop_(false), shutdown_refcount_(0) {
int num_workers = options_.num_workers(); int num_workers = options_.num_workers();
// Number of workers can't be 0 if we do not accept thread donation. // Number of workers can't be 0 if we do not accept thread donation.
// TODO(guantaol): replaces the hard-coded number with a flag. // TODO(guantaol): replaces the hard-coded number with a flag.

@ -71,9 +71,9 @@ class LibuvEventManager {
const Options options_; const Options options_;
// Whether the EventManager workers should be stopped. // Whether the EventManager workers should be stopped.
grpc_core::Atomic<bool> should_stop_ = false; grpc_core::Atomic<bool> should_stop_;
// A refcount preventing the EventManager from shutdown. // A refcount preventing the EventManager from shutdown.
grpc_core::Atomic<int> shutdown_refcount_ = 0; grpc_core::Atomic<int> shutdown_refcount_;
// Worker threads of the EventManager. // Worker threads of the EventManager.
std::vector<grpc_core::Thread> workers_; std::vector<grpc_core::Thread> workers_;
}; };

@ -58,8 +58,7 @@ TEST(LibuvEventManager, ShutdownRefAsync) {
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
em->ShutdownRef(); em->ShutdownRef();
} }
grpc_core::Thread deleter( grpc_core::Thread deleter("deleter", [em](void*) { delete em; }, nullptr);
"deleter", [em](void*) { delete em; }, nullptr);
deleter.Start(); deleter.Start();
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1)); gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1));
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {

Loading…
Cancel
Save