5#ifndef FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_
6#define FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_
10#include "flutter/fml/compiler_specific.h"
11#include "flutter/fml/macros.h"
15class PlatformSemaphore;
60 [[nodiscard]]
bool Wait();
81 std::unique_ptr<PlatformSemaphore> impl_;
A traditional counting semaphore. Waits decrement the counter and Signal increments it.
bool IsValid() const
Check if the underlying semaphore handle could be created. Failure modes are platform specific and ma...
~Semaphore()
Destroy the counting semaphore.
void Signal()
Increment the count by one. Any pending Waits will be resolved at this point.
bool TryWait()
Decrement the counts if it is greater than zero. Returns false if the counter is already at zero.
Semaphore(uint32_t count)
Initializes the counting semaphore to a specified start count.
bool Wait()
Decrements the count and waits indefinitely if the value is less than zero for a Signal.