Deleted Added
sdiff udiff text old ( 11859:76c36516e0ae ) new ( 11937:e6621fafa62d )
full compact
1/*
2 * Copyright (c) 2012, 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 42 unchanged lines hidden (view full) ---

53 * An object starts out in the Running state. When the simulator
54 * prepares to take a snapshot or prepares a CPU for handover, it
55 * calls the drain() method to transfer the object into the Draining
56 * or Drained state. If any object enters the Draining state
57 * (Drainable::drain() returning >0), simulation continues until it
58 * all objects have entered the Drained state.
59 *
60 * Before resuming simulation, the simulator calls resume() to
61 * transfer the object to the Running state.
62 *
63 * \note Even though the state of an object (visible to the rest of
64 * the world through Drainable::getState()) could be used to determine
65 * if all objects have entered the Drained state, the protocol is
66 * actually a bit more elaborate. See Drainable::drain() for details.
67 */
68enum class DrainState {
69 Running, /** Running normally */
70 Draining, /** Draining buffers pending serialization/handover */
71 Drained /** Buffers drained, ready for serialization/handover */
72};
73#endif
74
75/**
76 * This class coordinates draining of a System.
77 *
78 * When draining the simulator, we need to make sure that all
79 * Drainable objects within the system have ended up in the drained

--- 68 unchanged lines hidden (view full) ---

148 void signalDrainDone();
149
150 public:
151 void registerDrainable(Drainable *obj);
152 void unregisterDrainable(Drainable *obj);
153
154 private:
155 /**
156 * Thread-safe helper function to get the number of Drainable
157 * objects in a system.
158 */
159 size_t drainableCount() const;
160
161 /** Lock protecting the set of drainable objects */
162 mutable std::mutex globalLock;
163

--- 92 unchanged lines hidden (view full) ---

256 * into a state where it is ready to be drained. The method is
257 * safe to call multiple times and there is no need to check that
258 * draining has been requested before calling this method.
259 */
260 void signalDrainDone() const {
261 switch (_drainState) {
262 case DrainState::Running:
263 case DrainState::Drained:
264 return;
265 case DrainState::Draining:
266 _drainState = DrainState::Drained;
267 _drainManager.signalDrainDone();
268 return;
269 }
270 }
271

--- 36 unchanged lines hidden ---