commit b4f45e0fa3e07a91623b1039dfea8dfa77f792e0
Author: Pirmin Duss <pirmin.duss@gapfruit.com>
Date:   Mon Sep 23 15:15:49 2019 +0200

    mutex fixes

diff --git a/include/grpc/impl/codegen/sync_custom.h b/include/grpc/impl/codegen/sync_custom.h
index 69b1bf6..dd0bb95 100644
--- a/include/grpc/impl/codegen/sync_custom.h
+++ b/include/grpc/impl/codegen/sync_custom.h
@@ -21,15 +21,15 @@
 
 #include <grpc/impl/codegen/port_platform.h>
 
-#include <grpc/impl/codegen/sync_generic.h>
+#include <base/lock.h>
 
 /* Users defining GPR_CUSTOM_SYNC need to define the following macros. */
 
 #ifdef GPR_CUSTOM_SYNC
 
-typedef GPR_CUSTOM_MU_TYPE gpr_mu;
-typedef GPR_CUSTOM_CV_TYPE gpr_cv;
-typedef GPR_CUSTOM_ONCE_TYPE gpr_once;
+typedef Genode::Lock gpr_mu;
+typedef pthread_cond_t gpr_cv;
+typedef pthread_once_t gpr_once;
 
 #define GPR_ONCE_INIT GPR_CUSTOM_ONCE_INIT
 
diff --git a/include/grpcpp/impl/codegen/sync.h b/include/grpcpp/impl/codegen/sync.h
index 146f182..d1a60cb 100644
--- a/include/grpcpp/impl/codegen/sync.h
+++ b/include/grpcpp/impl/codegen/sync.h
@@ -26,6 +26,7 @@
 #endif
 
 #include <mutex>
+#include <base/lock.h>
 
 #include <grpc/impl/codegen/log.h>
 #include <grpc/impl/codegen/sync.h>
@@ -58,7 +59,7 @@ class Mutex {
  private:
   union {
     gpr_mu mu_;
-    std::mutex do_not_use_sth_;
+	Genode::Lock do_not_use_sth_;
 #ifdef GPR_HAS_PTHREAD_H
     pthread_mutex_t do_not_use_pth_;
 #endif
diff --git a/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.h b/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.h
index b5bd935..e835bbf 100644
--- a/src/cpp/server/external_connection_acceptor_impl.h
+++ b/src/cpp/server/external_connection_acceptor_impl.h
@@ -20,7 +20,7 @@
 #define SRC_CPP_SERVER_EXTERNAL_CONNECTION_ACCEPTOR_IMPL_H_
 
 #include <memory>
-#include <mutex>
+#include <base/lock.h>
 
 #include <grpc/impl/codegen/grpc_types.h>
 #include <grpcpp/security/server_credentials.h>
@@ -60,7 +60,7 @@ class ExternalConnectionAcceptorImpl
   const grpc::string name_;
   std::shared_ptr<ServerCredentials> creds_;
   grpc_core::TcpServerFdHandler* handler_ = nullptr;  // not owned
-  std::mutex mu_;
+  Genode::Lock mu_;
   bool has_acceptor_ = false;
   bool started_ = false;
   bool shutdown_ = false;
diff --git a/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.cc b/src/lib/grpc/src/cpp/server/external_connection_acceptor_impl.cc
index 7f0e2dc..a788b0d 100644
--- a/src/cpp/server/external_connection_acceptor_impl.cc
+++ b/src/cpp/server/external_connection_acceptor_impl.cc
@@ -52,7 +52,7 @@ ExternalConnectionAcceptorImpl::ExternalConnectionAcceptorImpl(
 
 std::unique_ptr<experimental::ExternalConnectionAcceptor>
 ExternalConnectionAcceptorImpl::GetAcceptor() {
-  std::lock_guard<std::mutex> lock(mu_);
+  std::lock_guard<Genode::Lock> lock(mu_);
   GPR_ASSERT(!has_acceptor_);
   has_acceptor_ = true;
   return std::unique_ptr<experimental::ExternalConnectionAcceptor>(
@@ -61,7 +61,7 @@ ExternalConnectionAcceptorImpl::GetAcceptor() {
 
 void ExternalConnectionAcceptorImpl::HandleNewConnection(
     experimental::ExternalConnectionAcceptor::NewConnectionParameters* p) {
-  std::lock_guard<std::mutex> lock(mu_);
+  std::lock_guard<Genode::Lock> lock(mu_);
   if (shutdown_ || !started_) {
     // TODO(yangg) clean up.
     gpr_log(
@@ -76,12 +76,12 @@ void ExternalConnectionAcceptorImpl::HandleNewConnection(
 }
 
 void ExternalConnectionAcceptorImpl::Shutdown() {
-  std::lock_guard<std::mutex> lock(mu_);
+  std::lock_guard<Genode::Lock> lock(mu_);
   shutdown_ = true;
 }
 
 void ExternalConnectionAcceptorImpl::Start() {
-  std::lock_guard<std::mutex> lock(mu_);
+  std::lock_guard<Genode::Lock> lock(mu_);
   GPR_ASSERT(!started_);
   GPR_ASSERT(has_acceptor_);
   GPR_ASSERT(!shutdown_);
