eina file - use recursive locks for cache and file to avoid deadlock

since we have a sigbusd handler that flags an eina file with io errors
it has to walk the file cache and every file... taking locks. if those
locks were taking already in the current thread the sighandler was
called in... we'd deadlock. since this basicallly never happens (when
do we see i/o errors really? not much)... we never saw this as it'd
also reauire this race condition to happen too. but it is a problem
waiting to happen. this fixes that by moving to recrusive locks.

@fix
This commit is contained in:
Carsten Haitzler 2017-08-30 11:31:02 +09:00
parent 2cf1fd3be9
commit 15cdd9b71b
1 changed files with 2 additions and 2 deletions

View File

@ -426,7 +426,7 @@ eina_file_virtualize(const char *virtual_name, const void *data, unsigned long l
else
sprintf((char *)file->filename, tmpname, ti);
eina_lock_new(&file->lock);
eina_lock_recursive_new(&file->lock);
file->mtime = ti / 1000;
file->length = length;
#ifdef _STAT_VER_LINUX
@ -1063,7 +1063,7 @@ eina_file_init(void)
return EINA_FALSE;
}
eina_lock_new(&_eina_file_lock_cache);
eina_lock_recursive_new(&_eina_file_lock_cache);
eina_magic_string_set(EINA_FILE_MAGIC, "Eina_File");
return EINA_TRUE;