boolean takeTaskPermit()
    {
        while (true)
        {
            long current = permits.get();
            int taskPermits = taskPermits(current);
            if (taskPermits == 0)
                return false;
            if (permits.compareAndSet(current, updateTaskPermits(current, taskPermits - 1)))
            {
                if (taskPermits == maxTasksQueued && hasRoom.hasWaiters())
                    hasRoom.signalAll();
                return true;
            }
        }
    }
boolean takeTaskPermit ( ) { while ( true ) { long current = permits . get ( ) ; int taskPermits = taskPermits ( current ) ; if ( taskPermits == 0 ) return false ; if ( permits . compareAndSet ( current , updateTaskPermits ( current , taskPermits - 1 ) ) ) { if ( taskPermits == maxTasksQueued && hasRoom . hasWaiters ( ) ) hasRoom . signalAll ( ) ; return true ; } } }
that a proceeding call to tasks.poll() will return some work