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

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

96{
97 panic_if(_state == DrainState::Running,
98 "Trying to resume a system that is already running\n");
99
100 warn_if(_state == DrainState::Draining,
101 "Resuming a system that isn't fully drained, this is untested and "
102 "likely to break\n");
103
104 panic_if(_count != 0,
105 "Resume called in the middle of a drain cycle. %u objects "
106 "left to drain.\n", _count);
107
108 DPRINTF(Drain, "Resuming %u objects.\n", drainableCount());
109 _state = DrainState::Running;
110 for (auto *obj : _allDrainable)
111 obj->dmDrainResume();
112}
113
114void
115DrainManager::preCheckpointRestore()
116{
117 panic_if(_state != DrainState::Running,
118 "preCheckpointRestore() called on a system that isn't in the "
119 "Running state.\n");

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

149DrainManager::unregisterDrainable(Drainable *obj)
150{
151 std::lock_guard<std::mutex> lock(globalLock);
152 auto o = std::find(_allDrainable.begin(), _allDrainable.end(), obj);
153 assert(o != _allDrainable.end());
154 _allDrainable.erase(o);
155}
156
157size_t
158DrainManager::drainableCount() const
159{
160 std::lock_guard<std::mutex> lock(globalLock);
161 return _allDrainable.size();
162}
163
164

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

184 _drainState == DrainState::Drained);
185
186 return _drainState;
187}
188
189void
190Drainable::dmDrainResume()
191{
192 panic_if(_drainState != DrainState::Drained,
193 "Trying to resume an object that hasn't been drained\n");
194
195 _drainState = DrainState::Running;
196 drainResume();
197}