RFC: KUSER_SHARED_DATA update patch to fix bug 29168

Marcus Meissner meissner at suse.de
Wed Mar 21 08:20:32 CDT 2012


On Tue, Mar 20, 2012 at 06:40:37PM -0700, Joey Yandle wrote:
> Hi everybody,
> 
> As originally discovered by Carsten Juttner, Star Wars: The Old Republic
> uses the time values in KUSER_SHARED_DATA to trigger network send
> buffers.  wine does not currently update these values, so TOR does not
> make it past an initial server handshake.
> 
> I'm attaching my current patch which fixes this.  It updates the values
> every 15600000 nanoseconds as does Windows 7, and presumably all Windows
> versions.  The words of the timers are written in the correct order for
> applications to detect clock tick.
> 
> It uses a separate thread which does nothing else; a previous attempt at
> an NtTimer based solution did not work, presumably due to irregularity
> in the exact callback times.  Attempts at setting thread priority were
> also abandoned after many people were unable to run the code.
> 
> The patch does not check the return code of nanosleep; I could add code
> to nanosleep again for the remaining time in the case of an interrupt,
> but didn't think it was necessary.  I could also change it to use
> clock_nanosleep, which would allow for more absolute timing.
> 
> Please let me know what you think.

- pthread_create() is pretty much a no-go.

  Use Win32 apis instead (CreateThread() and WaitFor*)

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


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?).

Ciao, Marcus



More information about the wine-devel mailing list