Closed PeterTh closed 8 years ago
Thank you for pointing this out. I was trying an alternative to thread-local-storage because that doesn't work right in DLLs on all versions of Windows. I'll definitely look into this.
Well, the simplest solution would be to mutex the write accesses and change the reads to find.
The logic that was storing per-thread timing turns out not to be necessary as long as I limit the interest to the thread that is using the D3D9 swapchain. DrDaxxy has isolated the exact conditional jump that needs to be bypassed and this code becomes obsolete.
Well, that's even better. Code that doesn't exist can't fail ;)
I doubt it occurs often in practice, but in principle lines like https://github.com/Kaldaien/TZF/blob/4c026b318a489294d5aecc8afba94eab4261f12d/tzf_dsound/framerate.cpp#L154 called from arbitrary threads are a race condition per the standard.