stdcpp reader-writer lock container class
$ dotnet add package SiddiqSoft.RWLContainerqueuetryWaitItem with a given timeout on the object.StorageType and the thread receiving the object is going to destroy the object.std::shared_ptr<><shared_mutex> and .<mutex>C++20.nlohmann::json only in our tests and the library is aware to provide a conversion operator if library is detected.#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.