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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
6ec11f2a
Commit
6ec11f2a
authored
Jul 14, 2016
by
yang-g
Browse files
Options
Downloads
Patches
Plain Diff
prevent spurious wake up and unstarted/already shutdown server
parent
e89dc6ce
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/grpc++/server.h
+1
-0
1 addition, 0 deletions
include/grpc++/server.h
src/cpp/server/server.cc
+6
-1
6 additions, 1 deletion
src/cpp/server/server.cc
test/cpp/end2end/async_end2end_test.cc
+7
-0
7 additions, 0 deletions
test/cpp/end2end/async_end2end_test.cc
with
14 additions
and
1 deletion
include/grpc++/server.h
+
1
−
0
View file @
6ec11f2a
...
...
@@ -179,6 +179,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen {
grpc
::
mutex
mu_
;
bool
started_
;
bool
shutdown_
;
bool
shutdown_notified_
;
// The number of threads which are running callbacks.
int
num_running_cb_
;
grpc
::
condition_variable
callback_cv_
;
...
...
...
...
This diff is collapsed.
Click to expand it.
src/cpp/server/server.cc
+
6
−
1
View file @
6ec11f2a
...
...
@@ -281,6 +281,7 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
:
max_message_size_
(
max_message_size
),
started_
(
false
),
shutdown_
(
false
),
shutdown_notified_
(
false
),
num_running_cb_
(
0
),
sync_methods_
(
new
std
::
list
<
SyncRequest
>
),
has_generic_service_
(
false
),
...
...
@@ -462,14 +463,18 @@ void Server::ShutdownInternal(gpr_timespec deadline) {
while
(
num_running_cb_
!=
0
)
{
callback_cv_
.
wait
(
lock
);
}
shutdown_notified_
=
true
;
shutdown_cv_
.
notify_all
();
}
}
void
Server
::
Wait
()
{
grpc
::
unique_lock
<
grpc
::
mutex
>
lock
(
mu_
);
while
(
started_
&&
!
shutdown_notified_
)
{
shutdown_cv_
.
wait
(
lock
);
}
}
void
Server
::
PerformOpsOnCall
(
CallOpSetInterface
*
ops
,
Call
*
call
)
{
static
const
size_t
MAX_OPS
=
8
;
...
...
...
...
This diff is collapsed.
Click to expand it.
test/cpp/end2end/async_end2end_test.cc
+
7
−
0
View file @
6ec11f2a
...
...
@@ -363,6 +363,13 @@ TEST_P(AsyncEnd2endTest, WaitAndShutdownTest) {
delete
wait_thread
;
}
TEST_P
(
AsyncEnd2endTest
,
ShutdownThenWait
)
{
ResetStub
();
SendRpc
(
1
);
server_
->
Shutdown
();
server_
->
Wait
();
}
// Test a simple RPC using the async version of Next
TEST_P
(
AsyncEnd2endTest
,
AsyncNextRpc
)
{
ResetStub
();
...
...
...
...
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
sign in
to comment