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