Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
50d65347
Commit
50d65347
authored
9 years ago
by
vjpai
Browse files
Options
Downloads
Patches
Plain Diff
Annotate sleep calls
parent
7e0289e1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/support/time_posix.c
+6
-1
6 additions, 1 deletion
src/core/support/time_posix.c
src/core/support/time_win32.c
+4
-0
4 additions, 0 deletions
src/core/support/time_win32.c
with
10 additions
and
1 deletion
src/core/support/time_posix.c
+
6
−
1
View file @
50d65347
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include
<unistd.h>
#include
<unistd.h>
#include
<grpc/support/log.h>
#include
<grpc/support/log.h>
#include
<grpc/support/time.h>
#include
<grpc/support/time.h>
#include
"src/core/iomgr/block_annotate.h"
static
struct
timespec
timespec_from_gpr
(
gpr_timespec
gts
)
{
static
struct
timespec
timespec_from_gpr
(
gpr_timespec
gts
)
{
struct
timespec
rv
;
struct
timespec
rv
;
...
@@ -126,6 +127,7 @@ void gpr_sleep_until(gpr_timespec until) {
...
@@ -126,6 +127,7 @@ void gpr_sleep_until(gpr_timespec until) {
gpr_timespec
now
;
gpr_timespec
now
;
gpr_timespec
delta
;
gpr_timespec
delta
;
struct
timespec
delta_ts
;
struct
timespec
delta_ts
;
int
ns_result
;
for
(;;)
{
for
(;;)
{
/* We could simplify by using clock_nanosleep instead, but it might be
/* We could simplify by using clock_nanosleep instead, but it might be
...
@@ -137,7 +139,10 @@ void gpr_sleep_until(gpr_timespec until) {
...
@@ -137,7 +139,10 @@ void gpr_sleep_until(gpr_timespec until) {
delta
=
gpr_time_sub
(
until
,
now
);
delta
=
gpr_time_sub
(
until
,
now
);
delta_ts
=
timespec_from_gpr
(
delta
);
delta_ts
=
timespec_from_gpr
(
delta
);
if
(
nanosleep
(
&
delta_ts
,
NULL
)
==
0
)
{
GRPC_IOMGR_START_BLOCKING_REGION
;
ns_result
=
nanosleep
(
&
delta_ts
,
NULL
);
GRPC_IOMGR_END_BLOCKING_REGION
;
if
(
ns_result
==
0
)
{
break
;
break
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/core/support/time_win32.c
+
4
−
0
View file @
50d65347
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
#include
<src/core/support/time_precise.h>
#include
<src/core/support/time_precise.h>
#include
<sys/timeb.h>
#include
<sys/timeb.h>
#include
"src/core/iomgr/block_annotate.h"
static
LARGE_INTEGER
g_start_time
;
static
LARGE_INTEGER
g_start_time
;
static
double
g_time_scale
;
static
double
g_time_scale
;
...
@@ -92,7 +94,9 @@ void gpr_sleep_until(gpr_timespec until) {
...
@@ -92,7 +94,9 @@ void gpr_sleep_until(gpr_timespec until) {
delta
=
gpr_time_sub
(
until
,
now
);
delta
=
gpr_time_sub
(
until
,
now
);
sleep_millis
=
sleep_millis
=
(
DWORD
)
delta
.
tv_sec
*
GPR_MS_PER_SEC
+
delta
.
tv_nsec
/
GPR_NS_PER_MS
;
(
DWORD
)
delta
.
tv_sec
*
GPR_MS_PER_SEC
+
delta
.
tv_nsec
/
GPR_NS_PER_MS
;
GRPC_IOMGR_START_BLOCKING_REGION
;
Sleep
(
sleep_millis
);
Sleep
(
sleep_millis
);
GRPC_IOMGR_END_BLOCKING_REGION
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment