ModalLock and FairModalLock

Hard · Coding

Implement a thread-safe ModalLock allowing concurrent holders of the same mode while excluding different modes, followed by a starvation-free FairModalLock that grants access in FIFO arrival groups.

This is a Pro problem. Pro unlocks the full prompt, a step-by-step walkthrough, a reference solution and tests you can run.

See Pro plans

More OpenAI problems