public void allocate(long size, OpOrder.Group opGroup) { assert size >= 0; while (true) { if (parent.tryAllocate(size)) { acquired(size); return; } WaitQueue.Signal signal = opGroup.isBlockingSignal(parent.hasRoom().register(parent.blockedTimerContext())); boolean allocated = parent.tryAllocate(size); if (allocated || opGroup.isBlocking()) { signal.cancel(); if (allocated) // if we allocated, take ownership acquired(size); else // otherwise we're blocking so we're permitted to overshoot our constraints, to just allocate without blocking allocated(size); return; } else signal.awaitUninterruptibly(); } }
public void allocate(long size, OpOrder.Group opGroup) { assert size >= 0; while (true) { if (parent.tryAllocate(size)) { acquired(size); return; } WaitQueue.Signal signal = opGroup.isBlockingSignal(parent.hasRoom().register(parent.blockedTimerContext())); boolean allocated = parent.tryAllocate(size); if (allocated || opGroup.isBlocking()) { signal.cancel(); if (allocated) // if we allocated, take ownership acquired(size); else // otherwise we're blocking so we're permitted to overshoot our constraints, to just allocate without blocking allocated(size); return; } else signal.awaitUninterruptibly(); } }
public void allocate(long size, OpOrder.Group opGroup) { assert size >= 0; while (true) { if (parent.tryAllocate(size)) { acquired(size); return; } WaitQueue.Signal signal = opGroup.isBlockingSignal(parent.hasRoom().register()); boolean allocated = parent.tryAllocate(size); if (allocated || opGroup.isBlocking()) { signal.cancel(); if (allocated) // if we allocated, take ownership acquired(size); else // otherwise we're blocking so we're permitted to overshoot our constraints, to just allocate without blocking allocated(size); return; } else signal.awaitUninterruptibly(); } }
public void allocate(long size, OpOrder.Group opGroup) { assert size >= 0; while (true) { if (parent.tryAllocate(size)) { acquired(size); return; } WaitQueue.Signal signal = opGroup.isBlockingSignal(parent.hasRoom().register(parent.blockedTimerContext())); boolean allocated = parent.tryAllocate(size); if (allocated || opGroup.isBlocking()) { signal.cancel(); if (allocated) // if we allocated, take ownership acquired(size); else // otherwise we're blocking so we're permitted to overshoot our constraints, to just allocate without blocking allocated(size); return; } else signal.awaitUninterruptibly(); } }
public void allocate(long size, OpOrder.Group opGroup) { assert size >= 0; while (true) { if (parent.tryAllocate(size)) { acquired(size); return; } WaitQueue.Signal signal = opGroup.isBlockingSignal(parent.hasRoom().register(parent.blockedTimerContext())); boolean allocated = parent.tryAllocate(size); if (allocated || opGroup.isBlocking()) { signal.cancel(); if (allocated) // if we allocated, take ownership acquired(size); else // otherwise we're blocking so we're permitted to overshoot our constraints, to just allocate without blocking allocated(size); return; } else signal.awaitUninterruptibly(); } }