Skip to content

Commit cd4b283

Browse files
authored
Update semaphore_linux.h
1 parent d37a674 commit cd4b283

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libipc/platform/semaphore_linux.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class semaphore {
6060
}
6161

6262
bool wait(std::uint64_t tm) noexcept {
63-
if (h == invalid()) return false;
63+
if (!valid()) return false;
6464
switch (tm) {
6565
case 0:
6666
return true;
@@ -72,7 +72,7 @@ class semaphore {
7272
return true;
7373
default: {
7474
auto ts = detail::make_timespec(tm);
75-
if (::sem_timedwait(h, &ts) != 0) {
75+
if (::sem_timedwait(h_, &ts) != 0) {
7676
if (errno != ETIMEDOUT) {
7777
ipc::error("fail sem_timedwait[%d]: tm = %zd, tv_sec = %ld, tv_nsec = %ld\n",
7878
errno, tm, ts.tv_sec, ts.tv_nsec);
@@ -85,7 +85,7 @@ class semaphore {
8585
}
8686

8787
bool post(std::uint32_t count) noexcept {
88-
if (h_ == invalid()) return false;
88+
if (!valid()) return false;
8989
for (std::uint32_t i = 0; i < count; ++i) {
9090
if (::sem_post(h_) != 0) {
9191
ipc::error("fail sem_post[%d]: %s\n", errno);

0 commit comments

Comments
 (0)