Inherits from NSObject
Conforms to NSLocking
Declared in PSPDFGlobalLock.h

Overview

PDF reading needs memory, which is a rare resource. So we lock access very carefully.

Tasks

Other Methods

Render Lock

  • – lock

    Will lock if the internal counter is depleted. Counter value will depend on the device (cores, memory)

  • – unlock

    Will unlock and potentially signal waiting threads on lock.

Document Provider Tracking

Properties

allowedOpenDocumentRequests

Number of requests we allow to keep in memory for faster access.

@property (atomic, assign) NSUInteger allowedOpenDocumentRequests

Declared In

PSPDFGlobalLock.h

Class Methods

sharedGlobalLock

Get global singleton.

+ (instancetype)sharedGlobalLock

Declared In

PSPDFGlobalLock.h

Instance Methods

deregisterDocumentProvider:

Removes any document provider who closed the document reference.

- (void)deregisterDocumentProvider:(PSPDFDocumentProvider *)documentProvider

Declared In

PSPDFGlobalLock.h

freeAllDocumentProviders

Requests a document close on all providers – might not be instant if they curently work with the reference.

- (void)freeAllDocumentProviders

Declared In

PSPDFGlobalLock.h

limitOpenDocumentProviders

Sends close messages until we have the allowed number of document providers open.

- (void)limitOpenDocumentProviders

Declared In

PSPDFGlobalLock.h

lock

Will lock if the internal counter is depleted. Counter value will depend on the device (cores, memory)

- (void)lock

Declared In

PSPDFGlobalLock.h

registerDocumentProvider:

Register any document provider that opens a CGPDFDocument reference.

- (void)registerDocumentProvider:(PSPDFDocumentProvider *)documentProvider

Declared In

PSPDFGlobalLock.h

unlock

Will unlock and potentially signal waiting threads on lock.

- (void)unlock

Declared In

PSPDFGlobalLock.h