aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/unit_tests
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-10-21 05:27:00 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-10-21 05:27:00 +0300
commit59b5ff29c961332f9deafd6300cda9ce2c7be5c1 (patch)
tree7b5fdd846d1d8f0d56a4f4f4a29ec57d265eaa49 /test/unit_tests
parentcode style (diff)
downloadwinapi-common-59b5ff29c961332f9deafd6300cda9ce2c7be5c1.tar.gz
winapi-common-59b5ff29c961332f9deafd6300cda9ce2c7be5c1.zip
shmem_tests: notify_all outside of lock
Diffstat (limited to 'test/unit_tests')
-rw-r--r--test/unit_tests/shmem.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/unit_tests/shmem.cpp b/test/unit_tests/shmem.cpp
index 26f1389..4220386 100644
--- a/test/unit_tests/shmem.cpp
+++ b/test/unit_tests/shmem.cpp
@@ -30,21 +30,21 @@ struct DataStruct {
void setter1_main() {
const auto data_struct = SharedObject<DataStruct>::open(shmem_name);
- std::unique_lock<std::mutex> lck{data_struct->mtx};
- BOOST_TEST_MESSAGE(data_struct.ptr());
-
- data_struct->cv.wait(lck, [&]() { return data_struct->data == main_data; });
- data_struct->data = setter1_data;
+ {
+ std::unique_lock<std::mutex> lck{data_struct->mtx};
+ data_struct->cv.wait(lck, [&]() { return data_struct->data == main_data; });
+ data_struct->data = setter1_data;
+ }
data_struct->cv.notify_all();
}
void setter2_main() {
auto data_struct = SharedObject<DataStruct>::open(shmem_name);
- std::unique_lock<std::mutex> lck{data_struct->mtx};
- BOOST_TEST_MESSAGE(data_struct.ptr());
-
- data_struct->cv.wait(lck, [&]() { return data_struct->data == setter1_data; });
- data_struct->data = setter2_data;
+ {
+ std::unique_lock<std::mutex> lck{data_struct->mtx};
+ data_struct->cv.wait(lck, [&]() { return data_struct->data == setter1_data; });
+ data_struct->data = setter2_data;
+ }
data_struct->cv.notify_all();
}