mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 01:06:45 +08:00
update
This commit is contained in:
parent
8832877c6d
commit
b78257de86
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || \
|
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || \
|
||||||
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \
|
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \
|
||||||
defined(WINCE) || defined(_WIN32_WCE)
|
defined(WINCE) || defined(_WIN32_WCE)
|
||||||
@ -19,7 +17,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
waiter_t* w_ = nullptr;
|
waiter_t* w_ = nullptr;
|
||||||
waiter_t::handle_t h_ = waiter_t::invalid();
|
waiter_t::handle_t h_ = waiter_t::invalid();
|
||||||
std::string n_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
waiter_impl() = default;
|
waiter_impl() = default;
|
||||||
@ -40,10 +37,6 @@ public:
|
|||||||
return (w_ != nullptr) && (h_ != waiter_t::invalid());
|
return (w_ != nullptr) && (h_ != waiter_t::invalid());
|
||||||
}
|
}
|
||||||
|
|
||||||
char const * name() const {
|
|
||||||
return n_.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool open(char const * name) {
|
bool open(char const * name) {
|
||||||
if (w_ == nullptr) return false;
|
if (w_ == nullptr) return false;
|
||||||
close();
|
close();
|
||||||
@ -55,7 +48,6 @@ public:
|
|||||||
if (!valid()) return;
|
if (!valid()) return;
|
||||||
w_->close(h_);
|
w_->close(h_);
|
||||||
h_ = waiter_t::invalid();
|
h_ = waiter_t::invalid();
|
||||||
n_.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wait() {
|
bool wait() {
|
||||||
|
|||||||
@ -9,6 +9,8 @@ namespace ipc {
|
|||||||
|
|
||||||
class waiter::waiter_ : public pimpl<waiter_> {
|
class waiter::waiter_ : public pimpl<waiter_> {
|
||||||
public:
|
public:
|
||||||
|
std::string n_;
|
||||||
|
|
||||||
detail::waiter_impl w_ { new detail::waiter };
|
detail::waiter_impl w_ { new detail::waiter };
|
||||||
~waiter_() { delete w_.waiter(); }
|
~waiter_() { delete w_.waiter(); }
|
||||||
};
|
};
|
||||||
@ -45,15 +47,20 @@ bool waiter::valid() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char const * waiter::name() const {
|
char const * waiter::name() const {
|
||||||
return impl(p_)->w_.name();
|
return impl(p_)->n_.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waiter::open(char const * name) {
|
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() {
|
void waiter::close() {
|
||||||
impl(p_)->w_.close();
|
impl(p_)->w_.close();
|
||||||
|
impl(p_)->n_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waiter::wait() {
|
bool waiter::wait() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user