(I wish I could tag this question for all class-constructing languages implementing threads, but here under Java, C++, C# and Ruby. Not that I am cool with all of these)
I think I have seen statements to this effect (that class constructors are threadsafe) on blog posts/tutorials. I can't trace any direct statements, but many posts and tutorials make the assumption, or do not even mention the problem of threads running on constructors and destructors. Sticking to Java, which has a history and some formal approach to multi-threading,
All these articles/webpages are written in a confident way and contain rounded discussions. They all mention the Java feature of method synchronization, so you would hope they might mention how this would affect the special methods of construction and destruction. But they do not.
But class constructors and destructors need to be considered like any class methods. Here is an article on Java,
Safe construction techniques in Java
about leaking 'this' references from constructors. And here are a couple of StackOverflow posts,
Incompletely constructed objects in Java,
Java constructor needs locking
showing constructors with thread issues. I doubt threading issues in special methods are limited to Java.
So, I'm wondering,
Is the assumption of threadsafety (however defined) based on the general layout of constructors? A tightly coded constructor with not much code would be close to re-entrant code (accepting data through parameters, etc.)
Or do interpreters/compilers handle constructors/destructors with special treatment or protections? For example, the Java memory model makes some comments on expectations at the end of construction, and I expect other language specifications will too.
Wikipedia on constructors has little on this. In a different context this post Constructors in Programming languages contains some hints, but is not about threadsafety.
While there many be information in specialist books, it would be good to have general (though language-specific mentions are interesting!) explanations/discussion on StackOverflow.