summaryrefslogtreecommitdiff
path: root/src/archive
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-22 16:06:07 +0100
committerMax Kellermann <max@musicpd.org>2017-12-22 16:09:03 +0100
commitd094c168aa0d9752ca2ffaf3d9569445c251ccc0 (patch)
tree4b99d2af3c2ce4719db38ec15f9ac27c14901579 /src/archive
parent4b18460bc6d69332c8d4da64bf6fcaceadbb4864 (diff)
archive/{iso9660,zzip}: unlock the mutex during I/O
Similar to commit 31ab78ae8e10af948ec95496df0d2abf1ea631a4
Diffstat (limited to 'src/archive')
-rw-r--r--src/archive/plugins/Iso9660ArchivePlugin.cxx2
-rw-r--r--src/archive/plugins/ZzipArchivePlugin.cxx4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx
index 9e4c4f16a..536745d85 100644
--- a/src/archive/plugins/Iso9660ArchivePlugin.cxx
+++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx
@@ -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;
diff --git a/src/archive/plugins/ZzipArchivePlugin.cxx b/src/archive/plugins/ZzipArchivePlugin.cxx
index 5ba087f48..fc1e50b16 100644
--- a/src/archive/plugins/ZzipArchivePlugin.cxx
+++ b/src/archive/plugins/ZzipArchivePlugin.cxx
@@ -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");