aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-06-13 19:04:43 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-06-13 19:04:43 -0700
commit058c9de8b28275484d9eef3c7d4cab45a52ec53e (patch)
tree9b0d36d0e9c046883f79ef8b3abe8d4807e7f086 /include
parenta47acad040242c03d5e812a40fd11225f327d45e (diff)
Added to server's shutdown docstrings
Diffstat (limited to 'include')
-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