The second is better. I doubt the first one will work.
However, I was trying to avoid the lock, hence the use of Interlocked.... if you use a lock, you should use a critical section, and forget about Interlocked...
A lock/critical section is the most reliable way to implement a threadsafe singleton. But it is also the slowest. It can be made faster with double-checked locking, which only uses the lock, if the singleton has not been created.
But i want to do the entire initialization with only one global variable, FInstance. (then the code can also be used for other objects than singletons. One lock for one singleton is not a big issue, but imagine you want to lazily initialize thousands of objects, then you might need to have thousands of locks)
Hence, InterlockedCompareExchange. It only has the disadvantage that multiple threads might create a TSingleton instance, and then all threads except one thread free their own instance again