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
7c8b7564
Commit
7c8b7564
authored
8 years ago
by
Mark D. Roth
Browse files
Options
Downloads
Patches
Plain Diff
Update documentation for timer API.
parent
0b09df9e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/lib/iomgr/timer.h
+8
-9
8 additions, 9 deletions
src/core/lib/iomgr/timer.h
with
8 additions
and
9 deletions
src/core/lib/iomgr/timer.h
+
8
−
9
View file @
7c8b7564
...
...
@@ -49,11 +49,11 @@ typedef struct grpc_timer {
}
grpc_timer
;
/* Initialize *timer. When expired or canceled, timer_cb will be called with
*timer_cb_arg and
status
to indicate if it expired (
SUCCESS) or was
canceled (CANCELLED). timer_cb is guaranteed to be called
exactly once,
and application code should check the
status
to determine
how it was
invoked. The application callback is also responsible for
maintaining
information about when to free up any user-level state. */
*timer_cb_arg and
error set
to indicate if it expired (
GRPC_ERROR_NONE) or
was
canceled (
GRPC_ERROR_
CANCELLED). timer_cb is guaranteed to be called
exactly once,
and application code should check the
error
to determine
how it was
invoked. The application callback is also responsible for
maintaining
information about when to free up any user-level state. */
void
grpc_timer_init
(
grpc_exec_ctx
*
exec_ctx
,
grpc_timer
*
timer
,
gpr_timespec
deadline
,
grpc_iomgr_cb_func
timer_cb
,
void
*
timer_cb_arg
,
gpr_timespec
now
);
...
...
@@ -74,8 +74,8 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
In all of these cases, the cancellation is still considered successful.
They are essentially distinguished in that the timer_cb will be run
exactly once from either the cancellation (with
status
CANCELLED)
or from the activation (with
status SUCCESS)
exactly once from either the cancellation (with
error GRPC_ERROR_
CANCELLED)
or from the activation (with
error GRPC_ERROR_NONE).
Note carefully that the callback function MAY occur in the same callstack
as grpc_timer_cancel. It's expected that most timers will be cancelled (their
...
...
@@ -83,14 +83,13 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
that cancellation costs as little as possible. Making callbacks run inline
matches this aim.
Requires:
cancel() must happen after
add
() on a given timer */
Requires: cancel() must happen after
init
() on a given timer */
void
grpc_timer_cancel
(
grpc_exec_ctx
*
exec_ctx
,
grpc_timer
*
timer
);
/* iomgr internal api for dealing with timers */
/* Check for timers to be run, and run them.
Return true if timer callbacks were executed.
Drops drop_mu if it is non-null before executing callbacks.
If next is non-null, TRY to update *next with the next running timer
IF that timer occurs before *next current value.
*next is never guaranteed to be updated on any given execution; however,
...
...
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