aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/support
diff options
context:
space:
mode:
authorGravatar jtattermusch <jtattermusch@google.com>2014-12-09 15:54:14 -0800
committerGravatar Michael Lumish <mlumish@google.com>2014-12-09 17:48:44 -0800
commit275b3ac04dbe5654a38de47e7f4ee6b9b7ca7b8e (patch)
treefe8efd5bff4f8440cc0bedffdb81d093b65dbdc0 /src/core/support
parent1ef8175bc5e300538a248aef88f4ed9ca033cdf1 (diff)
Getting rid of MS C++ warning when compiling GPR on Windows.
1>c:\users\jtattermusch\grpc_tar\src\core\support\sync_win32.c(97): warning C4244: 'function' : conversion from 'gpr_int64' to 'DWORD', possible loss of data Change on 2014/12/09 by jtattermusch <jtattermusch@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=81724253
Diffstat (limited to 'src/core/support')
-rw-r--r--src/core/support/sync_win32.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/support/sync_win32.c b/src/core/support/sync_win32.c
index eadaa970c9..b2e922565f 100644
--- a/src/core/support/sync_win32.c
+++ b/src/core/support/sync_win32.c
@@ -83,6 +83,7 @@ void gpr_cv_destroy(gpr_cv *cv) {
int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline) {
int timeout = 0;
+ DWORD timeout_max_ms;
if (gpr_time_cmp(abs_deadline, gpr_inf_future) == 0) {
SleepConditionVariableCS(cv, &mu->cs, INFINITE);
} else {
@@ -93,9 +94,9 @@ int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline) {
if (now_ms >= deadline_ms) {
timeout = 1;
} else {
- timeout =
- (SleepConditionVariableCS(cv, &mu->cs, deadline_ms - now_ms) == 0 &&
- GetLastError() == ERROR_TIMEOUT);
+ timeout_max_ms = (DWORD)min(deadline_ms - now_ms, INFINITE - 1);
+ timeout = (SleepConditionVariableCS(cv, &mu->cs, timeout_max_ms) == 0 &&
+ GetLastError() == ERROR_TIMEOUT);
}
}
return timeout;