From cd4b28380c5deb664b5feabc9394d23c878a9c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E5=A4=B4=E4=BA=91?= Date: Sun, 12 Sep 2021 21:51:08 +0800 Subject: [PATCH] Update semaphore_linux.h --- src/libipc/platform/semaphore_linux.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libipc/platform/semaphore_linux.h b/src/libipc/platform/semaphore_linux.h index b355124..b2a0ca3 100644 --- a/src/libipc/platform/semaphore_linux.h +++ b/src/libipc/platform/semaphore_linux.h @@ -60,7 +60,7 @@ public: } bool wait(std::uint64_t tm) noexcept { - if (h == invalid()) return false; + if (!valid()) return false; switch (tm) { case 0: return true; @@ -72,7 +72,7 @@ public: return true; default: { auto ts = detail::make_timespec(tm); - if (::sem_timedwait(h, &ts) != 0) { + if (::sem_timedwait(h_, &ts) != 0) { if (errno != ETIMEDOUT) { ipc::error("fail sem_timedwait[%d]: tm = %zd, tv_sec = %ld, tv_nsec = %ld\n", errno, tm, ts.tv_sec, ts.tv_nsec); @@ -85,7 +85,7 @@ public: } bool post(std::uint32_t count) noexcept { - if (h_ == invalid()) return false; + if (!valid()) return false; for (std::uint32_t i = 0; i < count; ++i) { if (::sem_post(h_) != 0) { ipc::error("fail sem_post[%d]: %s\n", errno);