mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
adjust test, chunk_storages revert to static
This commit is contained in:
parent
349094561f
commit
e3c8f8edc1
@ -137,11 +137,13 @@ auto& chunk_storages() {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
thread_local ipc::unordered_map<std::size_t, chunk_t> chunk_s;
|
static ipc::unordered_map<std::size_t, chunk_t> chunk_s;
|
||||||
return chunk_s;
|
return chunk_s;
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk_info_t *chunk_storage_info(std::size_t chunk_size) {
|
chunk_info_t *chunk_storage_info(std::size_t chunk_size) {
|
||||||
|
static std::mutex lock;
|
||||||
|
IPC_UNUSED_ std::lock_guard<std::mutex> guard {lock};
|
||||||
return chunk_storages()[chunk_size].get_info(chunk_size);
|
return chunk_storages()[chunk_size].get_info(chunk_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -75,8 +75,8 @@ void test_basic(char const * name) {
|
|||||||
EXPECT_FALSE(que1.try_send(test2));
|
EXPECT_FALSE(que1.try_send(test2));
|
||||||
|
|
||||||
que_t que2 { que1.name(), ipc::receiver };
|
que_t que2 { que1.name(), ipc::receiver };
|
||||||
EXPECT_TRUE(que1.send(test1));
|
ASSERT_TRUE(que1.send(test1));
|
||||||
EXPECT_TRUE(que1.try_send(test2));
|
ASSERT_TRUE(que1.try_send(test2));
|
||||||
|
|
||||||
EXPECT_EQ(que2.recv(), test1);
|
EXPECT_EQ(que2.recv(), test1);
|
||||||
EXPECT_EQ(que2.recv(), test2);
|
EXPECT_EQ(que2.recv(), test2);
|
||||||
@ -128,7 +128,11 @@ void test_sr(char const * name, int s_cnt, int r_cnt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ASSERT_TRUE((i >= 0) && (i < (int)data_set__.get().size()));
|
ASSERT_TRUE((i >= 0) && (i < (int)data_set__.get().size()));
|
||||||
EXPECT_EQ(data_set__.get()[i], got);
|
if (data_set__.get()[i] != got) {
|
||||||
|
printf("data_set__.get()[%d] != got, size = %zd/%zd\n",
|
||||||
|
i, data_set__.get()[i].size(), got.size());
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user