mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
Added a cleanup interface for queue
This commit is contained in:
parent
5071fb5db6
commit
29678f1d41
@ -55,6 +55,10 @@ public:
|
||||
queue_conn(const queue_conn&) = delete;
|
||||
queue_conn& operator=(const queue_conn&) = delete;
|
||||
|
||||
void clear() noexcept {
|
||||
elems_h_.clear();
|
||||
}
|
||||
|
||||
bool connected() const noexcept {
|
||||
return connected_ != 0;
|
||||
}
|
||||
|
||||
@ -302,3 +302,10 @@ TEST(Queue, prod_cons_NvN_broadcast) {
|
||||
test_sr(elems_t<ipc::relat::multi , ipc::relat::multi , ipc::trans::broadcast>{}, i, i, "mmb");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Queue, clear) {
|
||||
queue_t<ipc::relat::single, ipc::relat::single, ipc::trans::unicast> que{"test-queue-clear"};
|
||||
EXPECT_TRUE(ipc_ut::expect_exist("test-queue-clear", true));
|
||||
que.clear();
|
||||
EXPECT_TRUE(ipc_ut::expect_exist("test-queue-clear", false));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user