On 2/1/2015 4:05 PM, Mike wrote:
Agreed, but in the current druntime implementation, by the time the program reaches main, 2 threads have already been initiated. There is also some runtime and code-size overhead with TLS, even if one is building a single-threaded executable. I need to look into this in more detail though before I start spouting ideas. But I certainly welcome the dialogue.
You can use __gshared to not get TLS, and a freestanding implementation doesn't necessarily imply no threads.
Back in C land, I have some experience in making code that is buildable for both single and multi thread. The result wasn't worth it (bugs and complexity) - it was far better to always build for multi thread and have a runtime adapt itself for single thread dynamically.