Chain-Load: fix planning and wait logic

two rather obvious bugfixes
 (well, after watching the Scheduler in action...)
 - the first planning-chunk needs an offset
 - the future to block on must be setup before any dispatch happens
This commit is contained in:
Fischlurch 2023-12-07 02:39:40 +01:00
parent 72f11549e6
commit 21fbe09ee0

View file

@ -1290,14 +1290,15 @@ cout <<"--> reschedule to "<<nextChunkLevel<<endl;
std::future<void>
performRun()
{
auto finished = attachNewCompletionSignal();
size_t numNodes = chainLoad_.size();
cout <<"+++ "<<markThread()<<": seed(num:"<<numNodes<<")"<<endl;
schedule_.allocate (numNodes);
startTime_ = anchorStartTime();
scheduler_.seedCalcStream (planningJob(0)
scheduler_.seedCalcStream (planningJob(calcNextLevel(0)-1)
,manID_
,calcLoadHint());
return attachNewCompletionSignal();
return finished;
}
public:
@ -1326,7 +1327,6 @@ cout <<"+++ "<<markThread()<<": seed(num:"<<numNodes<<")"<<endl;
std::future<void>
attachNewCompletionSignal()
{
signalDone_.set_exception (std::make_exception_ptr(std::future_error (std::future_errc::broken_promise)));
std::promise<void> notYetTriggered;
signalDone_.swap (notYetTriggered);
return signalDone_.get_future();