40 #ifndef __SIM_DRAIN_HH__
41 #define __SIM_DRAIN_HH__
void preCheckpointRestore()
Run state fixups before a checkpoint restore operation.
DrainManager & _drainManager
Convenience reference to the drain manager.
DrainState
Object drain/handover states.
Buffers drained, ready for serialization/handover.
size_t drainableCount() const
Thread-safe helper function to get the number of Drainable objects in a system.
bool allInState(DrainState state) const
Helper function to check if all Drainable objects are in a specific state.
Interface for objects that might require draining before checkpointing.
void dmDrainResume()
DrainManager interface to request a resume operation.
virtual DrainState drain()=0
Notify an object that it needs to drain its state.
std::atomic_uint _count
Number of objects still draining.
DrainState dmDrain()
DrainManager interface to request a drain operation.
This class coordinates draining of a System.
DrainState state() const
Get the simulators global drain state.
std::vector< Drainable * > _allDrainable
Set of all drainable objects.
void unregisterDrainable(Drainable *obj)
static DrainManager _instance
Singleton instance of the drain manager.
Draining buffers pending serialization/handover.
bool tryDrain()
Try to drain the system.
std::mutex globalLock
Lock protecting the set of drainable objects.
bool isDrained() const
Check if the system is drained.
virtual void notifyFork()
Notify a child process of a fork.
void registerDrainable(Drainable *obj)
static DrainManager & instance()
Get the singleton DrainManager instance.
virtual void drainResume()
Resume execution after a successful drain.
void resume()
Resume normal simulation in a Drained system.
void signalDrainDone() const
Signal that an object is drained.
DrainState _state
Global simulator drain state.
DrainState drainState() const
Return the current drain state of an object.
void signalDrainDone()
Notify the DrainManager that a Drainable object has finished draining.
DrainState _drainState
Current drain state of the object.