PATCH: Get rid of superfluous dup() and close() calls.

Mike McCormack mike at
Thu Feb 6 16:50:09 CST 2003

Hi Martin,

OK, what happens if one thread closes an FD in the middle of another 
thread's read operation (that might take multiple accesses to an FD)?  I 
think that's unlikely, but that seems to me to be what the dup/close 
business is all about.

It might be that the previous dup/close code had some similar bugs in 
it, but it handles the above problem in a well known way.

Another way to solve the problem would be to enter a critical section 
instead of dup'ing a handle, but that also has a cost, and somebody will 
forget to leave the critical section somewhere in the code...


Martin Wilck wrote:
> On Mon, 2003-02-03, I wrote:
>>Why is that relevant to Wine? 99% of the Wine code uses DOS/Windows
>>functions like WriteFile() anyway. All we need to do is make sure that
>>these functions handle the Unix fd's properly (and they will if they
>>don't call close()).
> What's up, people? I think at least I deserve an answer to this
> argument. Or is everybody just too busy?

More information about the wine-devel mailing list