On 11/14/2012 1:01 AM, Benjamin Thaut wrote:
I still don't agree with you there. The struct would have clearly outlived any thread (as it was in the global scope) so at the point where it is destroyed there should be really only one thread left. So it IS destroyed in a single threaded context.
If you know this for a fact, then cast it to thread local. The compiler cannot figure this out for you, hence it issues the error.
The same is done for classes by the GC just that the GC ignores shared altogether.
That's different, because the GC verifies that there are *no* references to it from any thread first.