The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Async::Trampoline::Scheduler - decide which thunk should be evaluated next

DESCRIPTION

This is an internal module. The interface may change at any time.

new

    $scheduler = Async::Trampoline::Scheduler->new

Create a new scheduler.

enqueue

    $scheduler->enqueue($task)

    $scheduler->enqueue($task => @blocked)

Add a $task to the runnable queue.

$task: A task to be scheduled at some point in the future.

@blocked: Any number of tasks that depend on the $task. The blocked tasks will be added to the runnable queue once the $task is completed.

dequeue

    ($task) = $scheduler->dequeue
    ()      = $scheduler->dequeue

Get the next scheduled $task.

returns: A $task if there is a runnable task. An empty list if no tasks are runnable.

complete

    $scheduler->complete($task)

Mark a $task as completed.

This may move further tasks to the runnable state.

$task: A task that was completed.