a-foundation/src/main/java/com/ajjpj/afoundation/concurrent/SharedQueueBlockPushBlockPopImpl.java
@Override public void push (Runnable task) {
        final long _base;
        final long _top;

        synchronized (PUSH_LOCK) {
            _base = base;
            _top = top;

            if (_top == _base + mask) {
                throw new RejectedExecutionExceptionWithoutStacktrace ("Shared queue overflow");
            }

            tasks[asArrayIndex (_top)] = task;

            // volatile put for atomicity and to ensure ordering wrt. storing the task
            UNSAFE.putLongVolatile (this, OFFS_TOP, _top+1);
        }

        pool.onAvailableTask ();
    }
@Override public void push (Runnable task) {
        final long _base;
        final long _top;

        synchronized (PUSH_LOCK) {
            _base = base;
            _top = top;

            if (_top == _base + mask) {
                throw new RejectedExecutionExceptionWithoutStacktrace ("Shared queue overflow");
            }

            tasks[asArrayIndex (_top)] = task;

            // volatile put for atomicity and to ensure ordering wrt. storing the task
            UNSAFE.putLongVolatile (this, OFFS_TOP, _top+1);
        }

        pool.onAvailableTask ();
    }
@ Override public void push ( Runnable task ) { final long _base ; final long _top ; synchronized ( PUSH_LOCK ) { _base = base ; _top = top ; if ( _top == _base + mask ) { throw new RejectedExecutionExceptionWithoutStacktrace ( "Shared queue overflow" ) ; } tasks [ asArrayIndex ( _top ) ] = task ; // volatile put for atomicity and to ensure ordering wrt. storing the task UNSAFE . putLongVolatile ( this , OFFS_TOP , _top + 1 ) ; } pool . onAvailableTask ( ) ; }
Add a new task to the top of the shared queue, incrementing 'top'.
Add a new task to the top of the shared queue incrementing top .