PSPDFRenderQueue


@interface PSPDFRenderQueue : 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 achive 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.

  • Number of render jobs that run concurrently. A render job is used internally to render the image requested by one or multiple tasks.

    Defaults to a value that is best for the current device.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) NSUInteger concurrentRunningRenderRequests;

    Swift

    var concurrentRunningRenderRequests: UInt { get set }
  • Cancel all queued and running jobs.

    Declaration

    Objective-C

    - (void)cancelAllJobs;

    Swift

    func cancelAllJobs()
  • The minimum priority for tasks. Defaults to PSPDFRenderQueuePriorityUnspecified which makes it run all tasks.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic)
        PSPDFRenderQueuePriority minimumProcessPriority;

    Swift

    var minimumProcessPriority: PSPDFRenderQueuePriority { get set }
  • 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()