- Implements a thread-safe
queue
- Any number of threads can
tryWaitItem
with a given timeout on the object. - The queue must be given ownership of the
StorageType
and the thread receiving the object is going to destroy the object.
- Avoid re-implementing the rw-lock; standard C++ (since C++14) has a good reader-writer lock implementation.
- Provide a simple, convenience layer for dictionary containers.
- The internal storage type is a
std::shared_ptr<>
- You must be able to use
<shared_mutex>
and<mutex>
. - Minimal target is
C++20
. - We use
nlohmann::json
only in our tests and the library is aware to provide a conversion operator if library is detected. - CMake build system with development on MacOSX, Linux (Fedora) and Windows (VS2022).
- Use the nuget SiddiqSoft.RWLContainer
- Use CPM to integrate into you CMake project
#include "gtest/gtest.h"
#include "nlohmann/json.hpp"
#include "siddiqsoft/RWLContainer.hpp"
TEST(examples, Example1)
{
try
{
siddiqsoft::RWLContainer<std::string, std::string> myContainer;
auto item = myContainer.add("foo", "bar");
ASSERT_TRUE(item);
EXPECT_EQ("bar", *item);
}
catch (...)
{
EXPECT_TRUE(false); // if we throw then the test fails.
}
}
© 2021 Siddiq Software LLC. All rights reserved.