Instance Method

lock

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

Required.

Declaration

- (void)lock;

Discussion

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 completed, the thread relinquishes the lock by invoking unlock.

See Also

Working with Locks

- unlock

Relinquishes a previously acquired lock.

Required.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software