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
ab399fa5
Commit
ab399fa5
authored
10 years ago
by
Yang Gao
Browse files
Options
Downloads
Plain Diff
Merge pull request #761 from ctiller/chexxy
Add Server.Wait
parents
175533c8
6e57b9ed
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
include/grpc++/server.h
+5
-0
5 additions, 0 deletions
include/grpc++/server.h
src/cpp/server/server.cc
+15
-10
15 additions, 10 deletions
src/cpp/server/server.cc
with
20 additions
and
10 deletions
include/grpc++/server.h
+
5
−
0
View file @
ab399fa5
...
...
@@ -69,6 +69,11 @@ class Server final : private CallHook,
// Shutdown the server, block until all rpc processing finishes.
void
Shutdown
();
// Block waiting for all work to complete (the server must either
// be shutting down or some other thread must call Shutdown for this
// function to ever return)
void
Wait
();
private:
friend
class
ServerBuilder
;
...
...
This diff is collapsed.
Click to expand it.
src/cpp/server/server.cc
+
15
−
10
View file @
ab399fa5
...
...
@@ -265,21 +265,26 @@ bool Server::Start() {
}
void
Server
::
Shutdown
()
{
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mu_
);
if
(
started_
&&
!
shutdown_
)
{
shutdown_
=
true
;
grpc_server_shutdown
(
server_
);
cq_
.
Shutdown
();
std
::
unique_lock
<
std
::
mutex
>
lock
(
mu_
);
if
(
started_
&&
!
shutdown_
)
{
shutdown_
=
true
;
grpc_server_shutdown
(
server_
);
cq_
.
Shutdown
();
// Wait for running callbacks to finish.
while
(
num_running_cb_
!=
0
)
{
callback_cv_
.
wait
(
lock
);
}
// Wait for running callbacks to finish.
while
(
num_running_cb_
!=
0
)
{
callback_cv_
.
wait
(
lock
);
}
}
}
void
Server
::
Wait
()
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mu_
);
while
(
num_running_cb_
!=
0
)
{
callback_cv_
.
wait
(
lock
);
}
}
void
Server
::
PerformOpsOnCall
(
CallOpBuffer
*
buf
,
Call
*
call
)
{
static
const
size_t
MAX_OPS
=
8
;
size_t
nops
=
MAX_OPS
;
...
...
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