File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
include/sampleflow/producers Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ namespace SampleFlow
196196 // "generations" and an inner loop over the individual chains. We
197197 // exit from the inner loop when we have reached the desired number of
198198 // samples.
199- for (types::sample_index generation=0 ; true ; ++generation)
199+ for (types::sample_index generation=0 ; generation * n_chains < n_samples ; ++generation)
200200 {
201201 // A vector that will contain the std::future objects used to
202202 // hold results of either synchronous or asynchronous
@@ -315,11 +315,10 @@ namespace SampleFlow
315315 // guarantees a stable order.
316316 for (typename std::vector<OutputType>::size_type chain = 0 ; chain < n_chains; ++chain)
317317 {
318- // Return if we have already generated the desired number of
319- // samples. The ScopeExit object above also makes sure that
320- // we flush the downstream consumers.
318+ // Break the loop if we have already generated the desired number of
319+ // samples:
321320 if (generation * n_chains + chain >= n_samples)
322- return ;
321+ break ;
323322
324323 // Wait for the futures to be ready. Then output the new sample
325324 // (which may of course be equal to the old sample).
You can’t perform that action at this time.
0 commit comments