initialize mutex to fix lockup

This commit is contained in:
Antonio SJ Musumeci 2019-09-06 22:51:29 -04:00
parent 2dbcd2b07a
commit 50ad648ce4
3 changed files with 13 additions and 4 deletions

View file

@ -38,11 +38,15 @@ PolicyCache::Value::Value()
PolicyCache::PolicyCache(void)
: timeout(DEFAULT_TIMEOUT)
{
pthread_mutex_init(&_lock,NULL);
}
void
PolicyCache::erase(const char *fusepath_)
{
if(timeout == 0)
return;
pthread_mutex_lock(&_lock);
_cache.erase(fusepath_);
@ -56,6 +60,9 @@ PolicyCache::cleanup(const int prob_)
uint64_t now;
map<string,Value>::iterator i;
if(timeout == 0)
return;
if(rand() % prob_)
return;