Adjust the order of IOMgr initialization, so as to set up a customized

timer correctly.

Also, change the comment of grpc_timer::heap_index.
pull/19163/head
Guantao Liu 6 years ago
parent d43604a8b1
commit 740c931e23
  1. 2
      src/core/lib/iomgr/iomgr.cc
  2. 3
      src/core/lib/iomgr/timer.h

@ -57,10 +57,10 @@ void grpc_iomgr_init() {
gpr_mu_init(&g_mu); gpr_mu_init(&g_mu);
gpr_cv_init(&g_rcv); gpr_cv_init(&g_rcv);
grpc_core::Executor::InitAll(); grpc_core::Executor::InitAll();
grpc_timer_list_init();
g_root_object.next = g_root_object.prev = &g_root_object; g_root_object.next = g_root_object.prev = &g_root_object;
g_root_object.name = (char*)"root"; g_root_object.name = (char*)"root";
grpc_iomgr_platform_init(); grpc_iomgr_platform_init();
grpc_timer_list_init();
grpc_core::grpc_errqueue_init(); grpc_core::grpc_errqueue_init();
} }

@ -29,7 +29,8 @@
typedef struct grpc_timer { typedef struct grpc_timer {
grpc_millis deadline; grpc_millis deadline;
uint32_t heap_index; /* INVALID_HEAP_INDEX if not in heap */ // Uninitialized if not using heap, or INVALID_HEAP_INDEX if not in heap.
uint32_t heap_index;
bool pending; bool pending;
struct grpc_timer* next; struct grpc_timer* next;
struct grpc_timer* prev; struct grpc_timer* prev;

Loading…
Cancel
Save