mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
initialize mutex to fix lockup
This commit is contained in:
parent
2dbcd2b07a
commit
50ad648ce4
3 changed files with 13 additions and 4 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue