Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that Run and Cleanup are called after Prepare #898

Merged
merged 3 commits into from
Mar 8, 2018

Conversation

hakonsbm
Copy link
Contributor

@hakonsbm hakonsbm commented Mar 7, 2018

An error will now be raised if Run() or Cleanup() are called without calling Prepare() first.

This fixes #659.

@heplesser heplesser added ZC: Kernel DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL S: Normal Handle this with default priority T: Maintenance Work to keep up the quality of the code and documentation. I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels Mar 7, 2018
@heplesser heplesser added this to the NEST 2.16 milestone Mar 7, 2018
@@ -430,6 +431,7 @@ nest::SimulationManager::prepare()
* kernel().connection_manager.get_min_delay();
kernel().music_manager.enter_runtime( tick );
}
prepared_ = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check at the top of the function that ! prepared_ and otherwise throw an exception like in the other checks.

@@ -169,7 +169,8 @@ class SimulationManager : public ManagerInterface
delay to_step_; //!< update clock_+from_step<=T<clock_+to_step_
timeval t_slice_begin_; //!< Wall-clock time at the begin of a time slice
timeval t_slice_end_; //!< Wall-clock time at the end of time slice
long t_real_; //!< Accumunated wall-clock time spent simulating (in us)
long t_real_; //!< Accumulated wall-clock time spent simulating (in us)
bool prepared_; //!< indicates whether the SimulationManager has already been
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indicates whether the SimulationManager has already been seems to be missing a word or two.

ResetKernel
Cleanup
} fail_or_die

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And prepare after prepare test.

Copy link
Contributor

@apeyser apeyser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@apeyser apeyser merged commit 641f48c into nest:master Mar 8, 2018
@hakonsbm hakonsbm deleted the run_state_checks branch March 8, 2018 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Maintenance Work to keep up the quality of the code and documentation. ZC: Kernel DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add state checks for prepare-run-cleanup loop
3 participants