@Stefan_Salewski You're totally right! This would probably go horribly wrong. But I don't think this explains the error with the uninitialised HashSet. The HashSet itself just contains pointers; it doesn't care if they are still "valid" or not.
I'll change the code so that the HashSet is accessed with a "getter" that does "lazy" initialisation, per thread. If the error goes away, then that will "prove" the HashSet (and presumably every other complex threadvar object) needs to be initialised explicitly in each thread. If that is the case, it would be nice to have some syntax (something like the opposite of "static:") that takes care of that for you.
