Protocol

NSLocking

The elementary methods adopted by classes that define lock objects.

Declaration

@protocol NSLocking

Overview

A lock object is used to coordinate the actions of multiple threads of execution within a single application. By using a lock object, an application can protect critical sections of code from being executed simultaneously by separate threads, thus protecting shared data and other shared resources from corruption.

Topics

Working with Locks

- lock

Attempts to acquire a lock, blocking a thread’s execution until the lock can be acquired.

Required.

- unlock

Relinquishes a previously acquired lock.

Required.

See Also

Threads and Locking

NSThread

A thread of execution.

NSLock

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

NSRecursiveLock

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

NSDistributedLock

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

NSConditionLock

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

NSCondition

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