rob at codeweavers.com
Thu Jan 18 13:57:34 CST 2007
Teemu Ikonen wrote:
> On 1/18/07, Damjan Jovanovic <damjan.jov at gmail.com> wrote:
>> On 1/17/07, Teemu Ikonen <tpikonen at gmail.com> wrote:
>> If you don't wait for the forked process to finish before deleting the
>> file, then you have a bug called a race condition which apparently
>> manifests in wine and not in Windows: you're relying on the forked
>> process to open the file before it gets deleted.
> I know and I'm a bit surprised it actually works under windows as well
> as it does. This program is used extensively under various (modern)
> versions of windows, and it never fails this way.
Yeah, it might work all of the times you've run it, but it may fail if
the box is under very heavy load or different schedulers to the NT one
(for example, in Win9x or a new version of Windows).
> I agree this type of code is rather ugly and even incorrect (it's not
> my code, I just have access to it), but I assume the wine project is
> aiming for bug-for-bug compatibility with windows? Probably this kind
> of bug is hard to fix though, as this code relies on the windows
> scheduler giving the new process a rather large slice of CPU time
> before returning to the forking process.
It's quite easy to hack around - just add a Sleep call in
CreateProcessA/W after starting the new program.
More information about the wine-devel