Correct typecasts

pull/14894/head
Sree Kuchibhotla 7 years ago
parent a4cff2c1ce
commit dc01cb64c2
  1. 6
      src/core/lib/iomgr/pollset_custom.cc
  2. 14
      src/core/lib/iomgr/timer_generic.cc

@ -69,15 +69,15 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD();
gpr_mu_unlock(&pollset->mu);
grpc_millis now = grpc_core::ExecCtx::Get()->Now();
size_t timeout = 0;
grpc_millis timeout = 0;
if (deadline > now) {
timeout = static_cast<size_t>(deadline - now);
timeout = deadline - now;
}
// We yield here because the poll() call might yield
// control back to the application
grpc_core::ExecCtx* curr = grpc_core::ExecCtx::Get();
grpc_core::ExecCtx::Set(nullptr);
poller_vtable->poll(timeout);
poller_vtable->poll(static_cast<size_t>(timeout));
grpc_core::ExecCtx::Set(curr);
grpc_core::ExecCtx::Get()->InvalidateNow();
if (grpc_core::ExecCtx::Get()->HasWork()) {

@ -429,7 +429,8 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline,
note_deadline_change(shard);
if (shard->shard_queue_index == 0 && deadline < old_min_deadline) {
#if GPR_ARCH_64
gpr_atm_no_barrier_store(&g_shared_mutables.min_timer, deadline);
gpr_atm_no_barrier_store(
static_cast<gpr_atm*>(&g_shared_mutables.min_timer), deadline);
#else
// On 32-bit systems, gpr_atm_no_barrier_store does not work on 64-bit
// types (like grpc_millis). So all reads and writes to
@ -577,7 +578,8 @@ static grpc_timer_check_result run_some_expired_timers(grpc_millis now,
grpc_timer_check_result result = GRPC_TIMERS_NOT_CHECKED;
#if GPR_ARCH_64
grpc_millis min_timer = gpr_atm_no_barrier_load(&g_shared_mutables.min_timer);
grpc_millis min_timer = static_cast<grpc_millis>(gpr_atm_no_barrier_load(
static_cast<gpr_atm*>(&g_shared_mutables.min_timer)));
gpr_tls_set(&g_last_seen_min_timer, min_timer);
#else
// On 32-bit systems, gpr_atm_no_barrier_load does not work on 64-bit types
@ -637,8 +639,9 @@ static grpc_timer_check_result run_some_expired_timers(grpc_millis now,
}
#if GPR_ARCH_64
gpr_atm_no_barrier_store(&g_shared_mutables.min_timer,
g_shard_queue[0]->min_deadline);
gpr_atm_no_barrier_store(
static_cast<gpr_atm*>(&g_shared_mutables.min_timer),
g_shard_queue[0]->min_deadline);
#else
// On 32-bit systems, gpr_atm_no_barrier_store does not work on 64-bit
// types (like grpc_millis). So all reads and writes to
@ -702,7 +705,8 @@ static grpc_timer_check_result timer_check(grpc_millis* next) {
"TIMER CHECK BEGIN: now=%" PRId64 " next=%s tls_min=%" PRId64
" glob_min=%" PRId64,
now, next_str, min_timer,
gpr_atm_no_barrier_load(&g_shared_mutables.min_timer));
gpr_atm_no_barrier_load(
static_cast<gpr_atm*>(&g_shared_mutables.min_timer)));
#else
gpr_log(GPR_DEBUG,
"TIMER CHECK BEGIN: now=%" PRId64 " next=%s min=%" PRId64, now,

Loading…
Cancel
Save