Classes

The following classes are available globally.

  • A generic class that protects a resource of type T with a Lock.

    The user of a LockedResource accesses the resource via a read or write function. The resource itself is available only within the scope of the passed-in function, during which time the appropriate lock is guaranteed to be held.

    See more

    Declaration

    Swift

    open class LockedResource<T>
  • Allows you to store related receipts together in a single place, to prevent proliferation of Receipt references that might defeat certain memory management strategies, such as relying on automatic de-registration upon Receipt deallocation.

    See more

    Declaration

    Swift

    open class ReceiptSpindle
  • Registry is a generic class designed to keep track of items (of type T) in a thread-safe way.

    The lifetime of an item in the registry is determined by the Receipt that was returned when the item was registered.

    You must maintain at least one strong reference to the returned Receipt for the duration of the time that you want the item it represents to remain registered. Once the Receipt deallocates, the associated item is removed from the registry.

    See more

    Declaration

    Swift

    public class Registry<T>
  • ReadWriteCoordinator instances can be used to coordinate access to a mutable resource shared across multiple threads.

    You can think of the ReadWriteCoordinator as a read/write lock having the following properties:

    • The read lock allows any number of readers to execute concurrently.

    • The write lock allows one and only one writer to execute at a time.

    • As long as there is at least one reader executing, the write lock cannot be acquired.

    • As long as the write lock is held, no readers can execute.

    See more

    Declaration

    Swift

    public final class ReadWriteCoordinator