On Fri Feb 2 18:33:32 2024 +0000, Santino Mazza wrote:
Should I create a CriticalSection? I was reading about `InterlockedCompareExchangePointer`, I'm not entirely sure if it works for this case.
You could use `InterlockedCompareExchangePointer` - compare to NULL and free the locally-allocated version if it the exchange fails.
Or, you could use `InitOnceExecuteOnce` which I think would be lighter than a critical section.