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.


On Tue, May 22, 2007 at 07:05:41AM +0200, Jeroen Frijters wrote:
> 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.

No. Dave already described this a few times. If close() cannot execute
until accept() completes, then close() cannot be used to cause the
accept() to complete prematurely. Therefore, blocking accept() loop
lives forever, until the next accept() completes.

User space *cannot* solve this problem.

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

If .NET 2.0 does do this, then the close() interrupting accept() would
be broken.

Cheers,
mark

-- 
mark@mielke.cc / markm@ncf.ca / markm@nortel.com     __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/


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