Locking
When writing multithreaded programs, it is often necessary to find ways to ensure that certain resources or code sections can only be used by one thread at any given time. A special term, critical section, is used to refer to segments of code that require this special protection. For example, if two threads both attempt to do Application Kit drawing at the same time, the drawing commands sent to Quartz will be coming from both threads and could interleaved with each other. The resulting drawing will be an utter mess.
The use of Distributed Objects to isolate threads can provide a partial answer to this need, but it is not a complete solution. DO causes requests sent to a given thread to be serialized because the requests will be queued ...
Get Cocoa® Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.