a-foundation/src/main/java/com/ajjpj/afoundation/concurrent/LocalQueue.java
Runnable popLifo () {
        final long _top = top;
        final Runnable result = tasks[asArrayindex (_top-1)];
        if (result == null) {
            // The queue is empty. It is possible for the queue to be empty even if the previous unprotected read does not return null, but
            //  it will only ever return null if the queue really is empty: New entries are only added by the owning thread, and this method
            //  'popLifo()' is also only ever called by the owning thread.
            return null;
        }

        if (! UNSAFE.compareAndSwapObject (tasks, taskOffset (_top-1), result, null)) {
            // The CAS operation failing means that another thread pulled the top-most item from the queue, so the queue is now definitely
            //  empty. It also null'ed out the task in the array if it was previously available, allowing to to be GC'ed when processing is
            //  finished.
            return null;
        }

        // Since 'result' is not null, and was not previously consumed by another thread, we can safely consume it --> decrement 'top'
        UNSAFE.putOrderedLong (this, OFFS_TOP, _top-1);
        return result;
    }
Runnable popLifo () {
        final long _top = top;
        final Runnable result = tasks[asArrayindex (_top-1)];
        if (result == null) {
            // The queue is empty. It is possible for the queue to be empty even if the previous unprotected read does not return null, but
            //  it will only ever return null if the queue really is empty: New entries are only added by the owning thread, and this method
            //  'popLifo()' is also only ever called by the owning thread.
            return null;
        }

        if (! UNSAFE.compareAndSwapObject (tasks, taskOffset (_top-1), result, null)) {
            // The CAS operation failing means that another thread pulled the top-most item from the queue, so the queue is now definitely
            //  empty. It also null'ed out the task in the array if it was previously available, allowing to to be GC'ed when processing is
            //  finished.
            return null;
        }

        // Since 'result' is not null, and was not previously consumed by another thread, we can safely consume it --> decrement 'top'
        UNSAFE.putOrderedLong (this, OFFS_TOP, _top-1);
        return result;
    }
Fetch (and remove) a task from the top of the queue, i.e. LIFO semantics. This is only ever called from the owning thread, removing (or
at least reducing) contention at the top of the queue: No other thread operates there.