void Readable::resume() { auto& state = _readableState; if (!state.flowing) { state.flowing = true; if (!state.resumeScheduled) { state.resumeScheduled = true; process.nextTick([this]() { resume_(_readableState); }); } } }
void nest::SimulationManager::simulate( Time const& t ) { assert( kernel().is_initialized() ); t_real_ = 0; t_slice_begin_ = timeval(); t_slice_end_ = timeval(); if ( t == Time::ms( 0.0 ) ) return; if ( t < Time::step( 1 ) ) { LOG( M_ERROR, "SimulationManager::simulate", String::compose( "Simulation time must be >= %1 ms (one time step).", Time::get_resolution().get_ms() ) ); throw KernelException(); } if ( t.is_finite() ) { Time time1 = clock_ + t; if ( !time1.is_finite() ) { std::string msg = String::compose( "A clock overflow will occur after %1 of %2 ms. Please reset network " "clock first!", ( Time::max() - clock_ ).get_ms(), t.get_ms() ); LOG( M_ERROR, "SimulationManager::simulate", msg ); throw KernelException(); } } else { std::string msg = String::compose( "The requested simulation time exceeds the largest time NEST can handle " "(T_max = %1 ms). Please use a shorter time!", Time::max().get_ms() ); LOG( M_ERROR, "SimulationManager::simulate", msg ); throw KernelException(); } to_do_ += t.get_steps(); to_do_total_ = to_do_; const size_t num_active_nodes = prepare_simulation_(); // from_step_ is not touched here. If we are at the beginning // of a simulation, it has been reset properly elsewhere. If // a simulation was ended and is now continued, from_step_ will // have the proper value. to_step_ is set as in advance_time(). delay end_sim = from_step_ + to_do_; if ( kernel().connection_manager.get_min_delay() < end_sim ) to_step_ = kernel() .connection_manager.get_min_delay(); // update to end of time slice else to_step_ = end_sim; // update to end of simulation time // Warn about possible inconsistencies, see #504. // This test cannot come any earlier, because we first need to compute // min_delay_ // above. if ( t.get_steps() % kernel().connection_manager.get_min_delay() != 0 ) LOG( M_WARNING, "SimulationManager::simulate", "The requested simulation time is not an integer multiple of the minimal " "delay in the network. This may result in inconsistent results under the " "following conditions: (i) A network contains more than one source of " "randomness, e.g., two different poisson_generators, and (ii) Simulate " "is called repeatedly with simulation times that are not multiples of " "the minimal delay." ); resume_( num_active_nodes ); finalize_simulation_(); }