Design notes

Destroying objects through a thread

Assigning destruction to the universe thread is an optimization. The objects to be destroyed are lightweight enough to keep around until the end of a session instead of going through the trouble of figuring out when it is safe to throw them away. However, it is good practice to get rid of the objects as soon as they are no longer needed. (These objects might not be so lightweight in other simulations.)

No thread priorities

When a session is underway, there are three program-specific threads running: the universe thread, the refresh thread, and the mover thread. You can prioritize these threads to fine-tune the animation, but priorities aren't critical for this program. Instead, the threads work things out themselves through a simple locking scheme. To see concurrency control in action, see "Destroying actors cleanly" (page 39).

Minimal protocol for TAbstractActor

The protocol for TAbstractActor is minimal. For example, it is possible to put explosion behavior directly in TAbstractActor. However, future clients of the Universe subsystem might not want that behavior. Because TUniverse doesn't require explosion behavior, you need not implement it.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker