CAS is broken
Dustin Sallings
dustin at spy.net
Mon Nov 12 07:35:55 UTC 2007
On Nov 11, 2007, at 22:39, Tomash Brechko wrote:
> Then this would be it->cas_id = 0;, 'gets' will return current value,
> and 'cas' will do ++it->cas_id; (no need to have MAX_CAS_ID, C
> guarantees no error on wraparound of unsigned types, not to say that
> it will never happen).
An object isn't reused during a write. A new item is allocated when
you begin a set. The old one is served out until the new write is
finished (at which point the old one is added back to the free pool).
I wasn't as worried about the thread synchronization because
a) The abstraction makes it trivial to add a mutex if necessary.
b) It's likely already in a mutex (although I didn't check)
--
Dustin Sallings
More information about the memcached
mailing list