Protocol

NSLocking

The NSLocking protocol declares the elementary methods adopted by classes that define lock objects. 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.

Symbols

Working with Locks

func lock()
Required.

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

func unlock()
Required.

Relinquishes a previously acquired lock.