From 755c6833ae2d2eee87e80ed3b84c75e968f48c46 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Tue, 15 Oct 2019 18:08:41 +0200 Subject: [HICN-328] Reworking setSocketOption and getSocketOption to be thread-safe Change-Id: Ie22572822b9ac1e6c300fd7982035c799546bd76 Signed-off-by: Alberto Compagno --- libtransport/src/hicn/transport/utils/content_store.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libtransport/src/hicn/transport/utils/content_store.cc') diff --git a/libtransport/src/hicn/transport/utils/content_store.cc b/libtransport/src/hicn/transport/utils/content_store.cc index 1e6b9fcea..8e3435507 100644 --- a/libtransport/src/hicn/transport/utils/content_store.cc +++ b/libtransport/src/hicn/transport/utils/content_store.cc @@ -85,12 +85,17 @@ void ContentStore::erase(const Name &exact_name) { } void ContentStore::setLimit(size_t max_packets) { + utils::SpinLock::Acquire locked(cs_mutex_); max_content_store_size_ = max_packets; } -std::size_t ContentStore::getLimit() const { return max_content_store_size_; } +std::size_t ContentStore::getLimit() const { + utils::SpinLock::Acquire locked(cs_mutex_); + return max_content_store_size_; +} std::size_t ContentStore::size() const { + utils::SpinLock::Acquire locked(cs_mutex_); return content_store_hash_table_.size(); } -- cgit 1.2.3-korg