-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2014-11-30 19:08, schrieb Henri Verbeet:
That code wasn't anything particularly final, but InterlockedCompareExchange() implies a memory barrier and would prevent the CPU from seeing stale values. I don't think seeing a stale value would really matter here Yeah, I don't see where a stale value would come from, as this is the first read of this value in this function.
There may be a stale value in the CPU cache, but to my knowledge enforcing cache coherency is the CPU's job.
but if it does this probably also isn't enough since you're not protected from e.g. focus loss in the middle of a reset either. I tested focus loss during reset and reset during focus loss on Windows, and both of those cases segfault. I don't think we have to worry about this. I didn't provoke an actual race though - I called SetForegroundWindow and reset from test_proc. The result is the same with a D3DCREATE_MULTITHREADED device.
I think this also means we don't have to worry about races in wined3d_set_adapter_display_mode. Fwiw, device::reset has to be called from the thread that created the device, otherwise it fails. It does not have to be called from the thread that created the window though. (Same for CreateDevice obviously.) So the ACTIVATEAPP handler and reset can run concurrently in theory. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJUfJA+AAoJEN0/YqbEcdMwWGQP/29bSTK+b6Zviqv+px4MiPMh IA3/XVqO4PYI6XTeiqTMayVHcLZewO0lMUiCdf7P8bOJea+vaB8TD6gbwc3OObwz V1kUmcfg42tcgxnXmCBFjmQvnFIvyZJvEmr5HhVg/isN3VW+aZjfM9/og+WmIMzr OhMNiwMEETghRwwJQxOxMogpml1Mfdn3E5S60+k/RlUbedcs6Fkc9FoKh7xOecBQ /13cLEfO7RsVkqnjMgJQdkol4DogbkdG2/oG+A6ZN36frp3NKEmJGyqgF7B6NDh4 t3CDO7aiqTXrVY2fCHDL97obE03Envr0YNbmIVhijTa1uagLvIm5oNnQ4YLcght1 IYD5OIT04SpVkylZjLyr+Z269cw8sexJ0Gz+E+R5DNwfzEcvioZkiTmsPECq9zrr uOyAiyFKx+QsidJeE+ii6ghVDO731OWCMWyXsCjCkejtFo9Opz1lDGnBJ5helJZV xCuNJ/Sl4RHhFM0uvsWWSom7+8qD4kS5tKiYjxMkySXkrsYGC143AaS1bqjP0yCN H22VljxqB8uyB7Nr2wh+UkyrYmSGGiyQACXhm7VLyui0em1jWIo9zM0Cp4k7SyCZ 2nK5h5znM5UzzjRfE6td8Cj45kh8AUK+r425EOdnjGo+UPLT06Kc7RvKOahDxyHp YM13l/jIjF5QoepI69BC =/ZOE -----END PGP SIGNATURE-----