ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/FoundationKit/Protocols/NSLocking.rtf

This is NSLocking.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSLocking 
pard s0 li2872 tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Adopted By:tab b0 fs28 f1 NSConditionLock
fi0 NSLock
fi0 NSRecursiveLock 
fs20 
fs28 s7 fi-2771 ri1007 ql f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSLock.h 
fs20 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Protocol Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 This protocol is used by classes that provide lock objects. The lock objects provided by OpenStep are used only for protecting critical sections of code: sections that manipulate shared data and that can be executed simultaneously in several threads. Lock objects'd0except for NSConditionLock objects'd0contain no useful data.
fs16 
fs28 Although an object that isn't a lock could adopt the NSLocking protocol, it may be more desirable to design the object so that all locking is handled internally, through normal use rather than requiring that the object be explicitly locked and unlocked.
fs16 
fs28 In order to enable clients to only have locks when processes become multithreaded, it is permissible to unlock a lock freshly created (i.e. that has not been locked)'d0unless it is a recursive lock.
fs16 
fs28 Three classes conform to the NSLocking protocol: 
fs16 
fs28 pard s19 li854 fi0 ri1007 ql tx4509 tx10180 f0 b fs24 Classtab Usage
fs6 
fs24 pard s18 li4509 fi-3655 ri1007 ql tx4509 tx10432 f1 b0 fs28 fs10 
fs28 fi-3655 NSLocktab Protect critical sections of code.
fs16 
fs28 fi-3655 fi-3655 NSConditionLocktab Protects critical sections of code, but can also be used to postpone entry to a critical section until a condition is met. This class is functionally a superset of the NSLock class, though unlocking is slightly more expensive.
fs16 
fs28 fi-3655 fi-3655 NSRecursiveLocktab Protects critical sections from access by multiple threads, but allows a single thread to acquire a lock several times without deadlocking.
fs16 
fs28 fi-3655 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 None of these classes busy-waits while the lock is unavailable. All classes may all be efficiently used for long sections of atomic code. See the class specifications for these classes for further information on their behavior and usage.
fs16 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 
fs28 Locking Operations
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b lockb0 tab Acquires a lock. Applications generally do this when entering a critical section of their code. A thread will sleep if it can'27t immediately acquire the lock.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b unlockb0 tab Releases a lock. Applications generally do this when exiting a critical section of their code.
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.