Jun 23, 2015 at 9:23pm UTC
Hello everybody!
I'm writing an app, in which I'm creating an array of std::threads. They start immediately after being created. How to do it, so that they wait for creation of all the threads, so that I can start them all at the same time?
Thanks in advance!
Jun 23, 2015 at 10:14pm UTC
Have the threads wait() on an std::condition_variable, which you notify_all() once all the threads are created.
Why is this a problem, though?
Jun 23, 2015 at 10:35pm UTC
Thank you. It was problem for me as I still have a lot to learn about threading, but I wanted to get this answer quickly.
Jun 24, 2015 at 10:19am UTC
What I mean is, why is it a problem that the threads don't wait for all their partners to be created? What difference does it make?
Jun 24, 2015 at 9:05pm UTC
I'm just learning a little bit about DoS attacks.
Last edited on Jun 24, 2015 at 9:15pm UTC
Jun 24, 2015 at 9:56pm UTC
...And? Again, what difference does it make?
Jun 25, 2015 at 3:18pm UTC
I read, that it's better if all threads start sending data at the same time (but now I know it doesn't matter that much, if data is big).