NSLocking Mac OS X 10.0

This protocol is adopted by a class that implements lock objects. Locks are used in multithreaded applications to coordinate access to shared, thread-sensitive storage, or to control execution of critical portions of code (which usually deal with these same kinds of resources) that two or more threads may attempt to access simultaneously. The protocol declares two methods: lock and unlock. The lock message is used by clients to acquire a lock before executing critical sections of code, and the unlock method is used to relinquish a previously acquired lock.

The Foundation framework defines three classes that adopt the NSLocking protocol: NSLock, NSConditionLock, and NSRecursiveLock. See the class descriptions for these three classes, and Chapter 2 for more information.

@protocol NSLocking
 // Instance Methods
   - (void)lock;
   - (void)unlock;

    Part II: API Quick Reference
    Chapter 13. Foundation Classes