archive/{iso9660,zzip}: unlock the mutex during I/O

Similar to commit 31ab78ae8e
This commit is contained in:
Max Kellermann 2017-12-22 16:06:07 +01:00
parent 4b18460bc6
commit d094c168aa
3 changed files with 7 additions and 0 deletions

1
NEWS
View File

@ -3,6 +3,7 @@ ver 0.20.14 (not yet released)
- simple: fix file corruption in the presence of mount points
* archive
- bz2: fix deadlock
- reduce lock contention, fixing lots of xrun problems
* fix Solaris build failure
ver 0.20.13 (2017/12/18)

View File

@ -182,6 +182,8 @@ Iso9660ArchiveFile::OpenStream(const char *pathname,
size_t
Iso9660InputStream::Read(void *ptr, size_t read_size)
{
const ScopeUnlock unlock(mutex);
int readed = 0;
int no_blocks, cur_block;
size_t left_bytes = statbuf->size - offset;

View File

@ -138,6 +138,8 @@ ZzipArchiveFile::OpenStream(const char *pathname,
size_t
ZzipInputStream::Read(void *ptr, size_t read_size)
{
const ScopeUnlock unlock(mutex);
int ret = zzip_file_read(file, ptr, read_size);
if (ret < 0)
throw std::runtime_error("zzip_file_read() has failed");
@ -155,6 +157,8 @@ ZzipInputStream::IsEOF() noexcept
void
ZzipInputStream::Seek(offset_type new_offset)
{
const ScopeUnlock unlock(mutex);
zzip_off_t ofs = zzip_seek(file, new_offset, SEEK_SET);
if (ofs < 0)
throw std::runtime_error("zzip_seek() has failed");