On Wed Jun 19 10:38:29 2024 +0000, Alfred Agrell wrote:
That variable is 64bit, accesses are not atomic if compiled as 32bit. (And even if it was 32bit, data races are UB per the C spec; even if MS promises it's safe, I don't trust MinGW, Clang and TSan to make the same promises.) A third option would be dropping the lock before calling IMemInput_Receive, but that's difficult with strmbase's current architecture. A fourth option would be to access that variable with Interlocked functions, but the most convenient write operation (InterlockedExchange64) doesn't exist in Wine's headers. Wouldn't be hard to add, but that's a little out of scope for this MR, isn't it? So I'd say using that extra lock is the best option here.
Bah, somehow I misread "late" as being LONG.