(no title)
sghemawat | 15 years ago
bool CAS(db, key, oldvalue, newvalue) {
lock some mutex;
read key's value from db;
bool result = (value == oldvalue);
if (result) write key=>newvalue to db;
unlock;
return result;
}
This should be not much slower than any hard-wired CAS we could provide from inside leveldb.
unknown|15 years ago
[deleted]