| | |
| | | #include <thread> |
| | | #include <vector> |
| | | |
| | | using namespace bhome_shm; |
| | | using namespace bhome_msg; |
| | | |
| | | SharedMemory &TestShm() |
| | | { |
| | | static SharedMemory shm("utest_0", 1024 * 1024 * 512); |
| | | return shm; |
| | | } |
| | | |
| | | template <class A, class B> |
| | | struct IsSameType { |
| | |
| | | |
| | | BOOST_AUTO_TEST_CASE(PubSubTest) |
| | | { |
| | | const std::string shm_name("ShmPubSub"); |
| | | ShmRemover auto_remove(shm_name); //remove twice? in case of killed? |
| | | SharedMemory shm(shm_name, 1024 * 1024 * 50); |
| | | DEFER1(shm.Remove()); |
| | | SharedMemory &shm = TestShm(); |
| | | MsgI::BindShm(shm); |
| | | |
| | | auto Avail = [&]() { return shm.get_free_memory(); }; |
| | | auto init_avail = Avail(); |
| | | int *flag = shm.find_or_construct<int>("flag")(123); |
| | |
| | | |
| | | BOOST_AUTO_TEST_CASE(ReqRepTest) |
| | | { |
| | | const std::string shm_name("ShmReqRep"); |
| | | ShmRemover auto_remove(shm_name); |
| | | SharedMemory shm(shm_name, 1024 * 1024 * 512); |
| | | SharedMemory &shm = TestShm(); |
| | | MsgI::BindShm(shm); |
| | | |
| | | auto Avail = [&]() { return shm.get_free_memory(); }; |
| | | auto init_avail = Avail(); |