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
2eedca72
Commit
2eedca72
authored
8 years ago
by
Yuchen Zeng
Browse files
Options
Downloads
Patches
Plain Diff
Check the value of Next() in async examples
parent
900ed587
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/cpp/helloworld/greeter_async_client.cc
+3
-1
3 additions, 1 deletion
examples/cpp/helloworld/greeter_async_client.cc
examples/cpp/helloworld/greeter_async_server.cc
+3
-1
3 additions, 1 deletion
examples/cpp/helloworld/greeter_async_server.cc
with
6 additions
and
2 deletions
examples/cpp/helloworld/greeter_async_client.cc
+
3
−
1
View file @
2eedca72
...
@@ -87,7 +87,9 @@ class GreeterClient {
...
@@ -87,7 +87,9 @@ class GreeterClient {
void
*
got_tag
;
void
*
got_tag
;
bool
ok
=
false
;
bool
ok
=
false
;
// Block until the next result is available in the completion queue "cq".
// Block until the next result is available in the completion queue "cq".
cq
.
Next
(
&
got_tag
,
&
ok
);
// The return value of Next should always be checked. This return value
// tells us whether there is any kind of event or the cq_ is shutting down.
GPR_ASSERT
(
cq
.
Next
(
&
got_tag
,
&
ok
));
// Verify that the result from "cq" corresponds, by its tag, our previous
// Verify that the result from "cq" corresponds, by its tag, our previous
// request.
// request.
...
...
This diff is collapsed.
Click to expand it.
examples/cpp/helloworld/greeter_async_server.cc
+
3
−
1
View file @
2eedca72
...
@@ -160,7 +160,9 @@ class ServerImpl final {
...
@@ -160,7 +160,9 @@ class ServerImpl final {
// Block waiting to read the next event from the completion queue. The
// Block waiting to read the next event from the completion queue. The
// event is uniquely identified by its tag, which in this case is the
// event is uniquely identified by its tag, which in this case is the
// memory address of a CallData instance.
// memory address of a CallData instance.
cq_
->
Next
(
&
tag
,
&
ok
);
// The return value of Next should always be checked. This return value
// tells us whether there is any kind of event or cq_ is shutting down.
GPR_ASSERT
(
cq_
->
Next
(
&
tag
,
&
ok
));
GPR_ASSERT
(
ok
);
GPR_ASSERT
(
ok
);
static_cast
<
CallData
*>
(
tag
)
->
Proceed
();
static_cast
<
CallData
*>
(
tag
)
->
Proceed
();
}
}
...
...
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