diff options
Diffstat (limited to 'src/cpp/server/server_context.cc')
-rw-r--r-- | src/cpp/server/server_context.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 1ca6a2b906..a66ec4ac84 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -33,9 +33,10 @@ #include <grpc++/server_context.h> +#include <mutex> + #include <grpc++/completion_queue.h> #include <grpc++/impl/call.h> -#include <grpc++/impl/sync.h> #include <grpc++/support/time.h> #include <grpc/compression.h> #include <grpc/grpc.h> @@ -48,7 +49,7 @@ namespace grpc { // CompletionOp -class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface { +class ServerContext::CompletionOp final : public CallOpSetInterface { public: // initial refs: one in the server context, one in the cq CompletionOp() @@ -58,8 +59,8 @@ class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface { finalized_(false), cancelled_(0) {} - void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE; - bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; + void FillOps(grpc_op* ops, size_t* nops) override; + bool FinalizeResult(void** tag, bool* status) override; bool CheckCancelled(CompletionQueue* cq) { cq->TryPluck(this); @@ -76,20 +77,20 @@ class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface { private: bool CheckCancelledNoPluck() { - grpc::lock_guard<grpc::mutex> g(mu_); + std::lock_guard<std::mutex> g(mu_); return finalized_ ? (cancelled_ != 0) : false; } bool has_tag_; void* tag_; - grpc::mutex mu_; + std::mutex mu_; int refs_; bool finalized_; int cancelled_; }; void ServerContext::CompletionOp::Unref() { - grpc::unique_lock<grpc::mutex> lock(mu_); + std::unique_lock<std::mutex> lock(mu_); if (--refs_ == 0) { lock.unlock(); delete this; @@ -105,7 +106,7 @@ void ServerContext::CompletionOp::FillOps(grpc_op* ops, size_t* nops) { } bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { - grpc::unique_lock<grpc::mutex> lock(mu_); + std::unique_lock<std::mutex> lock(mu_); finalized_ = true; bool ret = false; if (has_tag_) { |