This is true, but is atomicity really required? If you don't mind the memory
being taken up for a few extra cycles, it seems to me that if you point the
API at the new version of the hash table, you can poll the reference count
for the old version once a second until it is zero, and then safely free the
memory. What's a little busywaiting among friends?

-S.

-----Original Message-----
From: Rob Mayoff [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 7:39 PM
Subject: Re: nsv vs. ns_cache vs. ns_share


+---------- On Sep 10, Jerry Asher said:
> I'm not sure.  It's true that the writer shouldn't just free the table --
I
> guess that readers need to refcount it (and unrefcount it),

You cannot, in C, atomically modify a reference count in memory.  It
might be possible to do so from assembler on some platforms, but a
portable implementation must use a lock..

Reply via email to