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

Martin Wilck Martin.Wilck at Fujitsu-Siemens.com
Tue Feb 11 04:41:47 CST 2003


Am Don, 2003-02-06 um 23.50 schrieb Mike McCormack:

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

That'd be impossible if close() calls were prohibited. I entirely agree
that the handling of Unix fd's must be up to the Wine core. But *because
of that* I despise the close() calls spread all about our code.
However, see my answer to Alexandre's mail for a constructive proposal.

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

I don't think that is an option. That would mean no two threads could
simultaneously read and write. A usage count on an fd would be possible.

Martin

-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy








More information about the wine-devel mailing list