Permalink
Browse files

Remove unused locks.

  • Loading branch information...
malin1993ml committed Apr 12, 2016
1 parent 69950ab commit 11c0d75a2fbcf61b6ebfdb2d4681c1eb8069ad45
Showing with 0 additions and 75 deletions.
  1. +0 −25 src/ee/anticache/AntiCacheEvictionManager.cpp
  2. +0 −50 src/ee/anticache/AntiCacheEvictionManager.h
@@ -90,21 +90,6 @@ AntiCacheEvictionManager::AntiCacheEvictionManager(const VoltDBEngine *engine) {
m_numdbs = 0;
m_migrate = false;
if (pthread_mutex_init(&lock, NULL) != 0) {
VOLT_ERROR("Mutex init failed!");
}
if (pthread_mutex_init(&(prio_lock.cv_mutex), NULL) != 0) {
VOLT_ERROR("Mutex init failed!");
}
if (pthread_mutex_init(&(prio_lock.cs_mutex), NULL) != 0) {
VOLT_ERROR("Mutex init failed!");
}
if (pthread_cond_init(&(prio_lock.cond), NULL) != 0) {
VOLT_ERROR("Mutex init failed!");
}
prio_lock.high_waiters = 0;
#ifdef ANTICACHE_COUNTER
m_sample.resize(SKETCH_SAMPLE_SIZE, 0);
m_sketch_thresh = 255 - 255 * SKETCH_THRESH / SKETCH_SAMPLE_SIZE;
@@ -116,16 +101,6 @@ AntiCacheEvictionManager::~AntiCacheEvictionManager() {
delete m_evictResultTable;
delete m_evicted_tuple;
TupleSchema::freeTupleSchema(m_evicted_schema);
pthread_mutex_destroy(&lock);
pthread_mutex_destroy(&prio_lock.cv_mutex);
pthread_mutex_destroy(&prio_lock.cs_mutex);
pthread_cond_destroy(&prio_lock.cond);
// int i;
//for (i = 1; i <= m_numdbs; i++) {
// delete m_db_lookup[i];
//}
}
void AntiCacheEvictionManager::initEvictResultTable() {
@@ -118,54 +118,6 @@ class AntiCacheEvictionManager {
void throwEvictedAccessException();
bool blockingMerge();
//pthread_mutex_t lock;
struct prio_lock_t {
pthread_cond_t cond;
pthread_mutex_t cv_mutex; /* Condition variable mutex */
pthread_mutex_t cs_mutex; /* Critical section mutex */
unsigned long high_waiters;
} prio_lock;
inline void prio_lock_low(prio_lock_t *prio_lock)
{
pthread_mutex_lock(&prio_lock->cv_mutex);
while (prio_lock->high_waiters || pthread_mutex_trylock(&prio_lock->cs_mutex))
{
pthread_cond_wait(&prio_lock->cond, &prio_lock->cv_mutex);
}
pthread_mutex_unlock(&prio_lock->cv_mutex);
}
inline void prio_unlock_low(prio_lock_t *prio_lock)
{
pthread_mutex_unlock(&prio_lock->cs_mutex);
pthread_mutex_lock(&prio_lock->cv_mutex);
if (!prio_lock->high_waiters)
pthread_cond_signal(&prio_lock->cond);
pthread_mutex_unlock(&prio_lock->cv_mutex);
}
inline void prio_lock_high(prio_lock_t *prio_lock)
{
pthread_mutex_lock(&prio_lock->cv_mutex);
prio_lock->high_waiters++;
pthread_mutex_unlock(&prio_lock->cv_mutex);
pthread_mutex_lock(&prio_lock->cs_mutex);
}
inline void prio_unlock_high(prio_lock_t *prio_lock)
{
pthread_mutex_unlock(&prio_lock->cs_mutex);
pthread_mutex_lock(&prio_lock->cv_mutex);
prio_lock->high_waiters--;
if (!prio_lock->high_waiters)
pthread_cond_signal(&prio_lock->cond);
pthread_mutex_unlock(&prio_lock->cv_mutex);
}
#ifdef ANTICACHE_COUNTER
// Data used by the Count-Min Sketch to track the access frequency
// of evicted tuples.
@@ -200,8 +152,6 @@ class AntiCacheEvictionManager {
std::vector<int32_t> m_evicted_block_ids_sync;
std::vector<int32_t> m_evicted_offsets_sync;
pthread_mutex_t lock;
std::map <int32_t, set <int32_t> > m_evicted_filter;
// whether the block to be merged is blockable, that is, all blocks that are needed
// are in blockable tiers

0 comments on commit 11c0d75

Please sign in to comment.