fixed implementation of hashtable_test_and_set
This commit is contained in:
parent
675bdce24a
commit
dd0c96a8a7
1 changed files with 7 additions and 1 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue