The classic synchronization technique is to use some form of lock. There are two kinds of synchronization locks in the Taligent Application Environment:
Another technique is to use surrogates (see "Surrogate objects" on page 121). If you can split an object into immutable shared data and per-thread mutable data, you can avoid some of the need for synchronization. For example, TGArea's are not shared between threads, but the master objects they point to are. Only the reference counts in the master objects need to be synchronized, because otherwise they do not change.
Synchronization should almost always be performed inside an object, not by clients. Counting on clients to make acquire and release calls is asking for trouble, as they are sure to forget one or the other at some point.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker