drain.hh (11002:4413195267fd) drain.hh (11360:40be59176869)
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

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

270 return;
271 }
272 }
273
274 public:
275 /** Return the current drain state of an object. */
276 DrainState drainState() const { return _drainState; }
277
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

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

270 return;
271 }
272 }
273
274 public:
275 /** Return the current drain state of an object. */
276 DrainState drainState() const { return _drainState; }
277
278 /**
279 * Notify a child process of a fork.
280 *
281 * When calling fork in gem5, we need to ensure that resources
282 * shared between the parent and the child are consistent. This
283 * method is intended to be overloaded to handle that. For
284 * example, an object could use this method to re-open input files
285 * to get a separate file description with a private file offset.
286 *
287 * This method is only called in the child of the fork. The call
288 * takes place in a drained system.
289 */
290 virtual void notifyFork() {};
291
278 private:
279 /** DrainManager interface to request a drain operation */
280 DrainState dmDrain();
281 /** DrainManager interface to request a resume operation */
282 void dmDrainResume();
283
284 /** Convenience reference to the drain manager */
285 DrainManager &_drainManager;
286
287 /**
288 * Current drain state of the object. Needs to be mutable since
289 * objects need to be able to signal that they have transitioned
290 * into a Drained state even if the calling method is const.
291 */
292 mutable DrainState _drainState;
293};
294
295#endif
292 private:
293 /** DrainManager interface to request a drain operation */
294 DrainState dmDrain();
295 /** DrainManager interface to request a resume operation */
296 void dmDrainResume();
297
298 /** Convenience reference to the drain manager */
299 DrainManager &_drainManager;
300
301 /**
302 * Current drain state of the object. Needs to be mutable since
303 * objects need to be able to signal that they have transitioned
304 * into a Drained state even if the calling method is const.
305 */
306 mutable DrainState _drainState;
307};
308
309#endif