From 19978d6f4bd46e76da43f81d6498430e5a026c1d Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 19 Mar 2015 15:31:51 +0200 Subject: [PATCH] transport: Make type_codec::type_id_to_type thread-local Data type objects are thread-local so the lookup map also needs to be thread-local. Fixes SMP issues when prepared statements are enabled which exercise the type encoders. Spotted by Tomek. Signed-off-by: Pekka Enberg --- transport/server.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transport/server.cc b/transport/server.cc index 3c14604376..37e24308d3 100644 --- a/transport/server.cc +++ b/transport/server.cc @@ -963,7 +963,7 @@ private: boost::bimaps::unordered_set_of, boost::bimaps::unordered_set_of>; - static const type_id_to_type_type type_id_to_type; + static thread_local const type_id_to_type_type type_id_to_type; public: static void encode(cql_server::response& r, data_type type) { type = type->underlying_type(); @@ -984,7 +984,7 @@ public: } }; -const type_codec::type_id_to_type_type type_codec::type_id_to_type = boost::assign::list_of +thread_local const type_codec::type_id_to_type_type type_codec::type_id_to_type = boost::assign::list_of (type_id::ASCII , ascii_type) (type_id::BIGINT , long_type) (type_id::BLOB , bytes_type)