aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar David G. Quintas <dgq@google.com>2016-06-14 10:57:43 -0700
committerGravatar GitHub <noreply@github.com>2016-06-14 10:57:43 -0700
commite697b7dbc6ad97e570334fecd2dd1cccaa83aa1a (patch)
tree1b574a9f664e2e34c5794953b470f05a27ebf6e3
parent0aa23d83ade7234d10fc27ea08b6713182ae996c (diff)
parent058c9de8b28275484d9eef3c7d4cab45a52ec53e (diff)
Merge pull request #6895 from dgquintas/async_docs_fixit
Added docs to server's shutdown docstrings
-rw-r--r--include/grpc++/impl/codegen/server_interface.h8
-rw-r--r--include/grpc++/server_builder.h17
2 files changed, 22 insertions, 3 deletions
diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h
index 7b7d5aa90b..3a3e052d9e 100644
--- a/include/grpc++/impl/codegen/server_interface.h
+++ b/include/grpc++/impl/codegen/server_interface.h
@@ -62,6 +62,10 @@ class ServerInterface : public CallHook {
/// Shutdown the server, blocking until all rpc processing finishes.
/// Forcefully terminate pending calls after \a deadline expires.
///
+ /// All completion queue associated with the server (for example, for async
+ /// serving) must be shutdown *after* this method has returned:
+ /// See \a ServerBuilder::AddCompletionQueue for details.
+ ///
/// \param deadline How long to wait until pending rpcs are forcefully
/// terminated.
template <class T>
@@ -70,6 +74,10 @@ class ServerInterface : public CallHook {
}
/// Shutdown the server, waiting for all rpc processing to finish.
+ ///
+ /// All completion queue associated with the server (for example, for async
+ /// serving) must be shutdown *after* this method has returned:
+ /// See \a ServerBuilder::AddCompletionQueue for details.
void Shutdown() { ShutdownInternal(gpr_inf_future(GPR_CLOCK_MONOTONIC)); }
/// Block waiting for all work to complete.
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index 54f01d11b5..aa7588d34d 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -119,9 +119,20 @@ class ServerBuilder {
std::shared_ptr<ServerCredentials> creds,
int* selected_port = nullptr);
- /// Add a completion queue for handling asynchronous services
- /// Caller is required to keep this completion queue live until
- /// the server is destroyed.
+ /// Add a completion queue for handling asynchronous services.
+ ///
+ /// Caller is required to shutdown the server prior to shutting down the
+ /// returned completion queue. A typical usage scenario:
+ ///
+ /// // While building the server:
+ /// ServerBuilder builder;
+ /// ...
+ /// cq_ = builder.AddCompletionQueue();
+ /// server_ = builder.BuildAndStart();
+ ///
+ /// // While shutting down the server;
+ /// server_->Shutdown();
+ /// cq_->Shutdown(); // Always *after* the associated server's Shutdown()!
///
/// \param is_frequently_polled This is an optional parameter to inform GRPC
/// library about whether this completion queue would be frequently polled