From 26e361c182e3001506cde02eaa0352fd9cc40729 Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Sat, 4 Mar 2017 00:25:14 +0000 Subject: [PATCH] Quick fix of bookstore-server race --- test/transcoding/bookstore-server.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/transcoding/bookstore-server.cc b/test/transcoding/bookstore-server.cc index 5abc026a1..216004d18 100644 --- a/test/transcoding/bookstore-server.cc +++ b/test/transcoding/bookstore-server.cc @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -47,6 +48,8 @@ void PrintRequest(const MessageType& message) { static ::google::protobuf::util::TypeResolver* type_resolver = ::google::protobuf::util::NewTypeResolverForDescriptorPool( "type.googleapis.com", message.GetDescriptor()->file()->pool()); + static std::mutex mutex; + std::lock_guard lock(mutex); std::string binary; if (!message.SerializeToString(&binary)) {