Usually, a simulation program uses a single simulation clock which is represented by an instance of this class. For more convenience and compatibility, this class therefore provides a mechanism to construct and return a default simulator which is used when an event is constructed without an explicit reference to a simulator, and when the simulator is accessed through the {@link Sim} class.
Note that this class is NOT thread-safe. Consequently, if a simulation program uses multiple threads, it should acquire a lock on a simulator (using a synchronized block) before accessing its state. Note however, that one can launch many simulations in parallel with as many threads, as long as each thread has its own Simulator.
|
|