Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 784d104b authored by Hansong Zhang's avatar Hansong Zhang Committed by android-build-merger
Browse files

Add debugging info in ReactiveSemaphore am: 8995b8ae am: 777c167b

am: dc0ad058

Change-Id: I6bf3cd5d0c87c716cbe6b65989f2b6da21eb2f23
parents 93cf43a4 dc0ad058
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#include "reactive_semaphore.h"

#include <error.h>
#include <sys/eventfd.h>
#include <unistd.h>
#include <functional>
@@ -33,19 +34,19 @@ ReactiveSemaphore::ReactiveSemaphore(unsigned int value) : fd_(eventfd(value, EF
ReactiveSemaphore::~ReactiveSemaphore() {
  int close_status;
  RUN_NO_INTR(close_status = close(fd_));
  ASSERT(close_status != -1);
  ASSERT_LOG(close_status != -1, "close failed: %s", strerror(errno));
}

void ReactiveSemaphore::Decrease() {
  uint64_t val = 0;
  auto read_result = eventfd_read(fd_, &val);
  ASSERT(read_result != -1);
  ASSERT_LOG(read_result != -1, "decrease failed: %s", strerror(errno));
}

void ReactiveSemaphore::Increase() {
  uint64_t val = 1;
  auto write_result = eventfd_write(fd_, val);
  ASSERT(write_result != -1);
  ASSERT_LOG(write_result != -1, "increase failed: %s", strerror(errno));
}

int ReactiveSemaphore::GetFd() {