PSPDFRenderQueue

Objective-C


@interface PSPDFRenderQueue : NSObject

Swift

class RenderQueue : NSObject

The render queue is responsible for scheduling and completing tasks. Typically you don’t create your own render queue but instead use the render queue provided by the render manager. Creating your own render queue is possible but due to internal resource constraints will almost never speed up rendering but instead the queues try to access the same resources and then need to wait until the resource becomes available.

The goal of the render queue is to keep the average time it takes to complete a render task at a minimum. To achieve this the render queue intelligently schedules and bundles tasks. Therefore the order in which scheduled tasks are executed is undefined and depends on many factors.

  • Schedules a render task in the receiving queue.

    The order in which tasks are executed is not necessarily the order in which they have been scheduled, nor the order of priority. The render queue makes an effort to serve as many tasks as possible in a timely manner. You should treat the order of execution of tasks as non-deterministic.

    Declaration

    Objective-C

    - (void)scheduleTask:(nonnull PSPDFRenderTask *)task;

    Swift

    func schedule(_ task: PSPDFRenderTask)

    Parameters

    task

    The render task to schedule in the queue.

  • Schedules multiple render tasks in the receiving queue.

    The order in which tasks are executed is not necessarily the order in which they have been scheduled, nor the order of priority. The render queue makes an effort to serve as many tasks as possible in a timely manner. You should treat the order of execution of tasks as non-deterministic.

    Declaration

    Objective-C

    - (void)scheduleTasks:(nonnull NSArray<PSPDFRenderTask *> *)tasks;

    Swift

    func schedule(_ tasks: [PSPDFRenderTask])

    Parameters

    tasks

    The render tasks to schedule in the queue.

  • Cancel all queued and running tasks.

    You should not call this method in production code. Instead to cancel tasks, call cancel on the tasks you actually want to cancel. Tasks that are started by the framework internally are cancelled by their respective owner if their result is no longer needed.

    Warning

    This method should only be used for debugging purpose and might result in unexpected behavior when called while the framework is requesting images.

    Declaration

    Objective-C

    - (void)cancelAllTasks;

    Swift

    func cancelAllTasks()