9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] removefid() question
@ 2002-07-30 11:49 Russ Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2002-07-30 11:49 UTC (permalink / raw)
  To: 9fans

> If I call removefid() without holding a reference to the Fid
> involved, AFAIK, it should unref the Fid and it should be deleted.
> Is this correct?
> 
> My removefid() seems not to do so, so I had to
> allocfid()
> ...
> lookupfid()
> removefid()
> closefid() // for alloc
> closefid() // for remove
> 
> I didn't change removefid() because I'm not sure it's a bug and
> I may be missing something.
> 
> What's the right way?

Removefid returns the fid it removed, if any.
So the right way is

	allocfid()
	closefid()	// for allocfid
	...
	lookupfid()
	closefid()	// for lookup
	closefid(removefid())

it bothers me that this is one more closefid than
you mentioned.

russ



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [9fans] removefid() question
@ 2002-07-11  9:02 Fco.J.Ballesteros
  0 siblings, 0 replies; 2+ messages in thread
From: Fco.J.Ballesteros @ 2002-07-11  9:02 UTC (permalink / raw)
  To: 9fans

If I call removefid() without holding a reference to the Fid
involved, AFAIK, it should unref the Fid and it should be deleted.
Is this correct?

My removefid() seems not to do so, so I had to
allocfid()
...
lookupfid()
removefid()
closefid() // for alloc
closefid() // for remove

I didn't change removefid() because I'm not sure it's a bug and
I may be missing something.

What's the right way?





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-30 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-30 11:49 [9fans] removefid() question Russ Cox
  -- strict thread matches above, loose matches on Subject: below --
2002-07-11  9:02 Fco.J.Ballesteros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).