1

Topic: At hierarchical creation of asynchronous tasks I get incorrect operation of the program

I created the first task which is fulfilled asynchronously and creates the second asynchronous tasks (both that, and another made with the help ljamba - functions). But why - that when is launched performance of the second task function from the first task starts!
Here is how I create the first task (in advance created two objects are stored in adjustments at me "SeparateArrayByClient" and "WriteFiles" for storage of asynchronous tasks for their serial performance):

int main (int argc, char *argv [])
{
std:: function <void (const variativeData&)> Separator = [ArrayOfMonth = std:: move (ArrayOfMonth), CurrentMonth] (const variativeData& Settings)
{
SeparateArrayByClient (ArrayOfMonth, CurrentMonth, Settings);
};
cstring Information = "Separate file by ticker:" + FullPathReadFile;
asyncTask* CurrentTask = new asyncTask (Settings, std:: move (Separator), Information, CurrentMonth);
asyncPool* SeparateArrayByClient = Settings.at <asyncPool *> ("SeparateArrayByClient");
SeparateArrayByClient-> AddTask (CurrentTask, "SeparateArrayByClient");
}

And here is how there are second tasks:

void SeparateArrayByClient (const array<allData>& ArrayOfData;
cuint32 CurrentMonth;
const variativeData& Settings)
{
std:: function <void (const myLib::variativeData&)> Bind = [] (const myLib::variativeData& Settings)
{
RunMarkAllFilesAsUnchanged ();
};
cstring Information = "Mark all files as unchanged";
myLib:: asyncTask* const CurrentTask = new myLib:: asyncTask (Settings, std:: move (Bind), Information);
myLib:: asyncPool* AsyncPool = Settings.at <myLib:: asyncPool *> ("WriteFiles");
AsyncPool-> AddTask (CurrentTask, "WriteFiles");
...
std:: function <void (const myLib::variativeData&)> Bind = [] (const myLib::variativeData& Settings)
{
RunCloseUnchangedFiles ();
};
cstring Information = "Close unchanged files";
myLib:: asyncTask* const CurrentTask = new myLib:: asyncTask (Settings, std:: move (Bind), Information);
myLib:: asyncPool* AsyncPool = Settings.at <myLib:: asyncPool *> ("WriteFiles");
AsyncPool-> AddTask (CurrentTask, "WriteFiles");
}

When the task "Mark all files as unchanged" it jumps in function SeparateArrayByClient (instead of RunMarkAllFilesAsUnchanged starts to be fulfilled!!!). Why the such happens?

2

Re: At hierarchical creation of asynchronous tasks I get incorrect operation of the program

All thanks, the error is found and was in other piece of the program.

3

Re: At hierarchical creation of asynchronous tasks I get incorrect operation of the program

AlekseySQL;
OFF/2:
In any asynchrony, the correct sausage, start and break phases = the SYNCHRONOUS!
Otherwise by contradiction - it is possible with to optimize - not to launch at all branches. To you  when they really start to work?
Good luck to you
(Round)