This function receives a shared Int32Array and can run in several workers. Find the synchronization bug.
JavaScript
function claimSlot(state) {
const claimed = state[0];
const capacity = state[1];
if (claimed >= capacity) return false;
state[0] = claimed + 1;
return true;
}