This commit is contained in:
mutouyun 2019-01-15 21:42:02 +08:00
parent 8832877c6d
commit b78257de86
2 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,5 @@
#pragma once
#include <string>
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || \
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \
defined(WINCE) || defined(_WIN32_WCE)
@ -19,7 +17,6 @@ public:
private:
waiter_t* w_ = nullptr;
waiter_t::handle_t h_ = waiter_t::invalid();
std::string n_;
public:
waiter_impl() = default;
@ -40,10 +37,6 @@ public:
return (w_ != nullptr) && (h_ != waiter_t::invalid());
}
char const * name() const {
return n_.c_str();
}
bool open(char const * name) {
if (w_ == nullptr) return false;
close();
@ -55,7 +48,6 @@ public:
if (!valid()) return;
w_->close(h_);
h_ = waiter_t::invalid();
n_.clear();
}
bool wait() {

View File

@ -9,6 +9,8 @@ namespace ipc {
class waiter::waiter_ : public pimpl<waiter_> {
public:
std::string n_;
detail::waiter_impl w_ { new detail::waiter };
~waiter_() { delete w_.waiter(); }
};
@ -45,15 +47,20 @@ bool waiter::valid() const {
}
char const * waiter::name() const {
return impl(p_)->w_.name();
return impl(p_)->n_.c_str();
}
bool waiter::open(char const * name) {
return impl(p_)->w_.open(name);
if (impl(p_)->w_.open(name)) {
impl(p_)->n_ = name;
return true;
}
return false;
}
void waiter::close() {
impl(p_)->w_.close();
impl(p_)->n_.clear();
}
bool waiter::wait() {