Re: [gnet-dev] Unix socket unlink func



I can do that easily enough.

So, just so I'm clear on what you want:

gnet_unix_socket_delete(): ignores reference count and destroys socket
completely.

gnet_unix_socket_unref(): --refcount; if recount == 0 then delete.

(and I agree, having unlink() did seem messy, but I was trying to be
consistent with what gnet_tcp* did).

M

On Thu, Oct 25, 2001 at 03:39:32PM -0400, David Helder wrote:
> 
> It just seems messy.  I'd be more inclined to change delete so that it
> always deletes the object instead of decrementing the ref count.  (We'd
> change the other objects to be consistent in 1.2.)
> 
> David
> 
> 
> On Thu, 25 Oct 2001, Mark Ferlatte wrote:
> 
> > On Thu, Oct 25, 2001 at 02:43:32PM -0400, David Helder wrote:
> > >
> > > Then why expose unix_socket_unlink?  My fear is the programmer won't
> > > understand it's called in unref and call it himself when he should call
> > > delete/unref.
> >
> > For the following scenerio:
> >
> > Server has socket open.
> >
> > Server recieves terminate message (via signal or protocol).
> >
> > The server should get rid of the socket in the filesystem before
> > shutting down.  However, if it just calls unref(), there's no guarantee
> > that it's going to go away, since the server socket could be ref'd more
> > than once.  This is normally a good thing, except when you're exiting,
> > and you don't care about ref counts anymore.
> >
> > What if I re-wrote the documentation comment to make it clearer what it
> > should be used for?
> >
> > M
> >
> > > David
> > >
> > >
> > > On Thu, 25 Oct 2001, Mark Ferlatte wrote:
> > >
> > > > On Thu, Oct 25, 2001 at 02:21:31PM -0400, David Helder wrote:
> > > > >
> > > > > Ok, I see.  Then why not call unix_socket_unlink from unix_socket_delete?
> > > >
> > > > Well, I do, kind of.
> > > >
> > > > unix_socket_delete() calls unix_socket_unref(), which does call
> > > > unix_socket_unlink() if the refcount of the socket hits zero.
> > > >
> > > > M
> > > >
> > >
> > > --
> > >       __          _    __ David Helder - dhelder umich edu
> > >   ___/ /__ __  __(_)__/ / <http://www.eecs.umich.edu/~dhelder>
> > >  / _  / _ `/ |/ / / _  /  Jungle Monkey: <http://www.junglemonkey.net>
> > >  |_,_/|_,_/|___/_/|_,_/   Paper CD Case: <http://www.papercdcase.com>
> > >
> >
> 
> -- 
>       __          _    __ David Helder - dhelder umich edu
>   ___/ /__ __  __(_)__/ / <http://www.eecs.umich.edu/~dhelder>
>  / _  / _ `/ |/ / / _  /  Jungle Monkey: <http://www.junglemonkey.net>
>  |_,_/|_,_/|___/_/|_,_/   Paper CD Case: <http://www.papercdcase.com>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]