fix another use of a reader lock by a source (comments explain more)

This commit is contained in:
Paul Davis
2022-04-30 17:25:53 -06:00
parent b74fb262fa
commit f3bf91b9b1

View File

@@ -308,7 +308,14 @@ AudioSource::read (Sample *dst, samplepos_t start, samplecnt_t cnt, int /*channe
{
assert (cnt >= 0);
ReaderLock lm (_lock);
/* as odd as it may seem, given that this method is used to *read* the
* source, that we would need a write lock here. The problem is that
* the audio file API we use (libsndfile) does not allow concurrent use
* of the same SNDFILE object, even for reading. Consequently, even
* readers must be serialized.
*/
WriterLock lm (_lock);
return read_unlocked (dst, start, cnt);
}