#ifndef ABSL_SYNCHRONIZATION_INTERNAL_SEM_WAITER_H_
#define ABSL_SYNCHRONIZATION_INTERNAL_SEM_WAITER_H_
#include "absl/base/config.h"
#ifdef ABSL_HAVE_SEMAPHORE_H
#include <semaphore.h>
#include <atomic>
#include <cstdint>
#include "absl/base/internal/thread_identity.h"
#include "absl/synchronization/internal/futex.h"
#include "absl/synchronization/internal/kernel_timeout.h"
#include "absl/synchronization/internal/waiter_base.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace synchronization_internal {
#define ABSL_INTERNAL_HAVE_SEM_WAITER 1
class SemWaiter : public WaiterCrtp<SemWaiter> {
public:
SemWaiter();
bool Wait(KernelTimeout t);
void Post();
void Poke();
static constexpr char kName[] = "SemWaiter";
private:
int TimedWait(KernelTimeout t);
sem_t sem_;
std::atomic<int> wakeups_;
};
} ABSL_NAMESPACE_END
}
#endif
#endif