Class

NSRecursiveLock

A lock that may be acquired multiple times by the same thread without causing a deadlock.

Overview

NSRecursiveLock defines a lock that may be acquired multiple times by the same thread without causing a deadlock, a situation where a thread is permanently blocked waiting for itself to relinquish a lock. While the locking thread has one or more locks, all other threads are prevented from accessing the code protected by the lock.

Topics

Acquiring a Lock

func lock(before: Date)

Attempts to acquire a lock before a given date.

func `try`()

Attempts to acquire a lock, and immediately returns a Boolean value that indicates whether the attempt was successful.

Naming the Lock

var name: String?

The name associated with the receiver.

Relationships

Inherits From

See Also

Threads and Locking

class Thread

A thread of execution.

protocol NSLocking

The elementary methods adopted by classes that define lock objects.

class NSLock

An object that coordinates the operation of multiple threads of execution within the same application.

class NSDistributedLock

A lock that multiple applications on multiple hosts can use to restrict access to some shared resource, such as a file.

class NSConditionLock

A lock that can be associated with specific, user-defined conditions.

class NSCondition

A condition variable whose semantics follow those used for POSIX-style conditions.