RFC: KUSER_SHARED_DATA update patch to fix bug 29168

Joey Yandle dragon at dancingdragon.be
Wed Mar 21 12:50:15 CDT 2012


> 
> - The shared data structure should be modified with atomic
>   accesses only. (Or use a criticalsection if possible.)
> 

According the this website, Windows updates the times too frequently to
use a critical section:


http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/

The values are written in the order High2, Low, High1.  Applications
read them in the reverse order; as long as the two High values are the
same, the composite value is considered correct.  This is a fairly
common algorithm for detecting clock tick without atomic operations or
critical sections.

I could certainly use atomic operations for each of the 32-bit word
writes.  But since Windows apps expect the word write order, I don't
think it's necessary or advisable to do 64-bit atomic ops.

> 
> However, I do not know if we can have additional threads at all in a
> Win32 process without confusing the win32 processes, or if this needs
> to be solved differently (APC?).
> 

A previous version of my patch used NtTimer/APC:

  http://bugs.winehq.org/attachment.cgi?id=39308

The APC code is commented out but still present in that version of the
patch.

It did not work, by which I mean SW:TOR did not successfully login.  It
was clearly the best solution, so I'd be happy to return to it if we can
make the callback times more precise.

cheers,

Joey



More information about the wine-devel mailing list