From 803b63af8fde20510906de590588e94be1d94be2 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Mon, 11 Jun 2018 19:46:16 +0900 Subject: [PATCH] Make atomic operation to get sequence numbers Change-Id: I4834cc0c7e826094a628e91af7572b3112cb8e72 Signed-off-by: Junghoon Park --- idlc/cpp_gen/cpp_gen_base_cb.h | 4 ++-- idlc/cpp_gen/cpp_proxy_header_gen_cb.h | 1 + idlc/cpp_gen/cpp_stub_header_gen_cb.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/idlc/cpp_gen/cpp_gen_base_cb.h b/idlc/cpp_gen/cpp_gen_base_cb.h index 76fc3c0..4dc00d6 100644 --- a/idlc/cpp_gen/cpp_gen_base_cb.h +++ b/idlc/cpp_gen/cpp_gen_base_cb.h @@ -61,7 +61,7 @@ const char CB_BUNDLE[] = R"__cls_bundle(class Bundle final { const char CB_CALLBACK_BASE[] = R"__cpp_cb( -int ##::CallbackBase::seq_num_ = 0; +std::atomic ##::CallbackBase::seq_num_ { 0 }; ##::CallbackBase::CallbackBase(int delegate_id, bool once) : id_(delegate_id), once_(once) { @@ -140,7 +140,7 @@ R"__cpp_cb( friend rpc_port_parcel_h operator << (rpc_port_parcel_h h, const CallbackBase& cb); friend rpc_port_parcel_h operator >> (rpc_port_parcel_h h, CallbackBase& cb); - static int seq_num_; + static std::atomic seq_num_; int id_; int seq_id_; bool once_; diff --git a/idlc/cpp_gen/cpp_proxy_header_gen_cb.h b/idlc/cpp_gen/cpp_proxy_header_gen_cb.h index 82bb804..292b7db 100644 --- a/idlc/cpp_gen/cpp_proxy_header_gen_cb.h +++ b/idlc/cpp_gen/cpp_proxy_header_gen_cb.h @@ -116,6 +116,7 @@ R"__cpp_cb( #include #include #include +#include )__cpp_cb"; diff --git a/idlc/cpp_gen/cpp_stub_header_gen_cb.h b/idlc/cpp_gen/cpp_stub_header_gen_cb.h index 4e65ec3..8cb4c1f 100644 --- a/idlc/cpp_gen/cpp_stub_header_gen_cb.h +++ b/idlc/cpp_gen/cpp_stub_header_gen_cb.h @@ -123,6 +123,7 @@ R"__cpp_cb( #include #include #include +#include )__cpp_cb"; -- 2.7.4