Attempts to acquire a lock.
- iOS 3.0–8.0Deprecated
- macOS 10.4–10.10Deprecated
- Mac Catalyst 13.0–13.0Deprecated
- Core Data
This method blocks a thread’s execution until the lock can be acquired. An application protects a critical section of code by requiring a thread to acquire a lock before executing the code. Once the critical section is past, the thread relinquishes the lock by invoking unlock.