This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: RFC: Too many race conditions.


David Daney wrote:
> The only way to close the race window using user space synchronization
> is to make the close block while you could be calling write().

That's not true. You can use ref counting to protect access to the fd and then close the fd when the ref count reaches zero. This way the actual native close can happen in any operation (read/write/close) or the finalizer, but is guaranteed only to happen when no other operation is in progress.

This is how .NET 2.0 does it. See http://blogs.msdn.com/cbrumme/archive/2004/02/20/77460.aspx for more information.

Regards,
Jeroen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]