Commit dfd2c9d1 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

refs #5239, closes #5240, remove unused functions in rwlock.h, fix bug in toku_cachetable_verify

git-svn-id: file:///svn/toku/tokudb@45626 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7fdc9d4f
...@@ -2441,11 +2441,12 @@ void toku_cachetable_verify (CACHETABLE ct) { ...@@ -2441,11 +2441,12 @@ void toku_cachetable_verify (CACHETABLE ct) {
if (p2==p) { if (p2==p) {
/* found it */ /* found it */
num_found++; num_found++;
continue; goto next;
} }
} }
fprintf(stderr, "Something in the clock chain is not hashed\n"); fprintf(stderr, "Something in the clock chain is not hashed\n");
assert(0); assert(0);
next:;
} }
assert (num_found == ct->n_in_table); assert (num_found == ct->n_in_table);
} }
......
...@@ -74,48 +74,6 @@ static inline void rwlock_read_lock(RWLOCK rwlock, toku_mutex_t *mutex) { ...@@ -74,48 +74,6 @@ static inline void rwlock_read_lock(RWLOCK rwlock, toku_mutex_t *mutex) {
rwlock->reader++; rwlock->reader++;
} }
static inline void rwlock_read_lock_and_unlock (RWLOCK rwlock, toku_mutex_t *mutex)
// Effect: Has the effect of obtaining a read lock and then unlocking it.
// Implementation note: This can be done faster than actually doing the lock/unlock
// Usage note: This is useful when we are waiting on someone who has the write lock, but then we are just going to try again from the top. (E.g., when releasing the ydb lock).
{
if (rwlock->writer || rwlock->want_write) {
rwlock->want_read++;
while (rwlock->writer || rwlock->want_write) {
toku_cond_wait(&rwlock->wait_read, mutex);
}
rwlock->want_read--;
}
// Don't increment reader.
}
// preferentially obtain a read lock (ignore request for write lock)
// expects: mutex is locked
static inline void rwlock_prefer_read_lock(RWLOCK rwlock, toku_mutex_t *mutex) {
if (rwlock->reader)
rwlock->reader++;
else
rwlock_read_lock(rwlock, mutex);
}
// try to acquire a read lock preferentially (ignore request for write lock).
// If a stall would happen (write lock is held), instead return EBUSY immediately.
// expects: mutex is locked
//Bug in ICL compiler prevents the UU definition from propogating to this header. Redefine UU here.
#define UU(x) x __attribute__((__unused__))
static inline int rwlock_try_prefer_read_lock(RWLOCK rwlock, toku_mutex_t *UU(mutex)) {
int r = EBUSY;
if (!rwlock->writer) {
rwlock->reader++;
r = 0;
}
return r;
}
// release a read lock // release a read lock
// expects: mutex is locked // expects: mutex is locked
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment