aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/support/sync_win32.c
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2016-01-28 08:38:43 -0800
committerGravatar Michael Lumish <mlumish@google.com>2016-01-28 08:38:43 -0800
commita570b73a48e4fb7e6b44dd70c3670a0bafb1d80d (patch)
tree070f33ce5f758db4f349341222625d4f82381464 /src/core/support/sync_win32.c
parentf846aaf41baf34d68f9aa7e3daa2c65cd75dd7f1 (diff)
parent929523a05e109d189c0fa14bdba05dbc3dfd081f (diff)
Merge pull request #4902 from nicolasnoble/win32-cleanup
Cleaning up Windows compilation.
Diffstat (limited to 'src/core/support/sync_win32.c')
-rw-r--r--src/core/support/sync_win32.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/support/sync_win32.c b/src/core/support/sync_win32.c
index 51a082b29e..84d412a75f 100644
--- a/src/core/support/sync_win32.c
+++ b/src/core/support/sync_win32.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -94,7 +94,11 @@ int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline) {
if (now_ms >= deadline_ms) {
timeout = 1;
} else {
- timeout_max_ms = (DWORD)min(deadline_ms - now_ms, INFINITE - 1);
+ if ((deadline_ms - now_ms) >= INFINITE) {
+ timeout_max_ms = INFINITE - 1;
+ } else {
+ timeout_max_ms = (DWORD)(deadline_ms - now_ms);
+ }
timeout = (SleepConditionVariableCS(cv, &mu->cs, timeout_max_ms) == 0 &&
GetLastError() == ERROR_TIMEOUT);
}