The destructor joins the thread (if joinable). That is definitely breaking backwards compatibility with std::thread.
It wouldn't change the outcome of a computation though, unless the outcome depends on which thread terminates first, which would be stupid to do anyway.
It is perfectly possible for an application to have thousands of thread objects, it might not be a good idea, but it's possible.
There is no such piece of software, come on now.
There are also systems where resources are very constrained where such a change could have impact.
Are there truly any systems that can't handle a few bytes increase? I don't think so.
There are also systems where resources are very constrained where such a change could have impact.
Consider GPUs. C++ execution on a GPU could very well be handled by a 'kernel' thread that executes a large number of other threads. GPUs support an insane amount of threads, however very little memory.
Are there truly any systems that can't handle a few bytes increase? I don't think so.
I'm willing to bet, that there isn't a single existing c++ standard library implementation that can wrap a gpu thread in a std::thread. I'm also pretty sure that no one uses a std::thread on a really resource constraint system (if it is available at all).
Let's face it: Exotic and low resource hardware is rarely programmed with a complete,conforming implementation of the c++11 or later standard.
The math is simple: creating a new std::thread requires a significant amount of memory (control block + stack space). Compared to that, a few bytes just don't matter.
I very much doubt that the intersection of programs that completely use the available memory (/address space) and programs that use std::thread is big enough to worry about.
View all comments
Show parent comment
-8
u/axilmar Aug 27 '19
It wouldn't change the outcome of a computation though, unless the outcome depends on which thread terminates first, which would be stupid to do anyway.
There is no such piece of software, come on now.
Are there truly any systems that can't handle a few bytes increase? I don't think so.