fixed implementation of hashtable_test_and_set

This commit is contained in:
Sears Russell 2009-11-24 01:32:59 +00:00
parent 675bdce24a
commit dd0c96a8a7

View file

@ -194,7 +194,13 @@ void * hashtable_insert(hashtable_t *ht, pageid_t p, void * val) {
return ret; return ret;
} }
void * hashtable_test_and_set(hashtable_t *ht, pageid_t p, void * val) { void * hashtable_test_and_set(hashtable_t *ht, pageid_t p, void * val) {
void * ret = hashtable_op(TRYINSERT, ht, p, val); hashtable_bucket_handle_t h;
void * ret = hashtable_begin_op(TRYINSERT, ht, p, val, &h);
if(ret) {
hashtable_end_op(LOOKUP, ht, val, &h);
} else {
hashtable_end_op(INSERT, ht, val, &h);
}
return ret; return ret;
} }
void * hashtable_lookup(hashtable_t *ht, pageid_t p) { void * hashtable_lookup(hashtable_t *ht, pageid_t p) {