24 Semaphore = (
void *)::OpenSemaphoreA(SEMAPHORE_MODIFY_STATE | SYNCHRONIZE,
25 FALSE, Config.Path.c_str());
26 if (Semaphore !=
nullptr)
32 if (Semaphore !=
nullptr)
33 ::CloseHandle((HANDLE)Semaphore);
47 if (HasImplicitSlot.exchange(
false, std::memory_order_acquire)) {
52 if (::WaitForSingleObject((HANDLE)Semaphore, 0) == WAIT_OBJECT_0) {
66 if (!IsInitialized || !
Slot.isValid())
69 if (
Slot.isImplicit()) {
70 [[maybe_unused]]
bool was_already_released =
71 HasImplicitSlot.exchange(
true, std::memory_order_release);
72 assert(!was_already_released &&
"Implicit slot released twice");
77 (void)::ReleaseSemaphore((HANDLE)Semaphore, 1, NULL);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
A JobSlot represents a single job slot that can be acquired from or released to a jobserver pool.
static JobSlot createExplicit(uint8_t V)
static JobSlot createImplicit()
JobserverClientImpl(const JobserverConfig &Config)
~JobserverClientImpl() override
void release(JobSlot Slot) override
Releases a job slot back to the pool.
JobSlot tryAcquire() override
Tries to acquire a job slot from the pool.
This is an optimization pass for GlobalISel generic memory operations.