Added a cleanup interface for waiter.

This commit is contained in:
mutouyun 2024-11-30 17:53:31 +08:00
parent acea9d74da
commit ab90437e44

View File

@ -51,6 +51,16 @@ public:
lock_.close(); lock_.close();
} }
void clear() noexcept {
cond_.clear();
lock_.clear();
}
static void clear_storage(char const *name) noexcept {
ipc::sync::condition::clear_storage(name);
ipc::sync::mutex::clear_storage(name);
}
template <typename F> template <typename F>
bool wait_if(F &&pred, std::uint64_t tm = ipc::invalid_value) noexcept { bool wait_if(F &&pred, std::uint64_t tm = ipc::invalid_value) noexcept {
IPC_UNUSED_ std::lock_guard<ipc::sync::mutex> guard {lock_}; IPC_UNUSED_ std::lock_guard<ipc::sync::mutex> guard {lock_};