Closed nmcclatchey closed 5 years ago
Done, thanks!
I verified that this bugfix fixes the bug in my program. I also found that if the main thread sleeps 10 ms after starting each thread, which I did so that the threads would get numbered in the order they're started as they add elements to threadStatus, each thread is passed the correct number before this bugfix, instead of being all passed 0 as with no delay.
In #58 , @phma noticed an issue, in that threads which were passed an argument in a for loop were not properly disambiguated by it. I have replicated the behavior, and determined that it is caused by the thread constructor not properly copying its arguments. This is a fatal flaw, so it must be addressed immediately.
This pull request eliminates the problem using the following steps:
std::decay<T>::type
for each argument of the thread's constructor).I recommend immediately updating this library. All projects that use this library should update their copy and recompile.
@alxvasilev , please merge this ASAP.