diff options
Diffstat (limited to 'src/core/support/time_posix.c')
-rw-r--r-- | src/core/support/time_posix.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/support/time_posix.c b/src/core/support/time_posix.c index dcecff0d05..eedfd0a060 100644 --- a/src/core/support/time_posix.c +++ b/src/core/support/time_posix.c @@ -41,6 +41,7 @@ #include <unistd.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include "src/core/support/block_annotate.h" static struct timespec timespec_from_gpr(gpr_timespec gts) { struct timespec rv; @@ -126,6 +127,7 @@ void gpr_sleep_until(gpr_timespec until) { gpr_timespec now; gpr_timespec delta; struct timespec delta_ts; + int ns_result; for (;;) { /* We could simplify by using clock_nanosleep instead, but it might be @@ -137,7 +139,10 @@ void gpr_sleep_until(gpr_timespec until) { delta = gpr_time_sub(until, now); delta_ts = timespec_from_gpr(delta); - if (nanosleep(&delta_ts, NULL) == 0) { + GRPC_SCHEDULING_START_BLOCKING_REGION; + ns_result = nanosleep(&delta_ts, NULL); + GRPC_SCHEDULING_END_BLOCKING_REGION; + if (ns_result == 0) { break; } } |