Skip to content

Adding multi-threading? #65

@Wouze

Description

@Wouze

Hey I'm kinda new to c++ stuff and I've been trying to use multi-threading, because I just have watched a video about it :)..

I want to ask you, why this approach doesn't work?
it seems to have no effect on the CPU usage.

this is the original code for one of the most time-consuming tasks:

for (Colony& colony : colonies)
{
    colony.update(dt, world);
}

and this is what I done:

for_each(std::execution::par,colonies.begin(), colonies.end(),
        [&dt, this](Colony& colony){
             colony.update(dt, world);
         });

May I have your opinion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions