input/nfs: use class ScopeUnlock
This commit is contained in:
parent
220d9528a3
commit
687ea53616
@ -96,10 +96,13 @@ NfsInputStream::DoRead()
|
|||||||
size_t nbytes = std::min<size_t>(std::min<uint64_t>(remaining, 32768),
|
size_t nbytes = std::min<size_t>(std::min<uint64_t>(remaining, 32768),
|
||||||
buffer_space);
|
buffer_space);
|
||||||
|
|
||||||
mutex.unlock();
|
|
||||||
Error error;
|
Error error;
|
||||||
bool success = NfsFileReader::Read(next_offset, nbytes, error);
|
bool success;
|
||||||
mutex.lock();
|
|
||||||
|
{
|
||||||
|
const ScopeUnlock unlock(mutex);
|
||||||
|
success = NfsFileReader::Read(next_offset, nbytes, error);
|
||||||
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
PostponeError(std::move(error));
|
PostponeError(std::move(error));
|
||||||
@ -135,9 +138,10 @@ NfsInputStream::DoResume()
|
|||||||
void
|
void
|
||||||
NfsInputStream::DoSeek(offset_type new_offset)
|
NfsInputStream::DoSeek(offset_type new_offset)
|
||||||
{
|
{
|
||||||
mutex.unlock();
|
{
|
||||||
|
const ScopeUnlock unlock(mutex);
|
||||||
NfsFileReader::CancelRead();
|
NfsFileReader::CancelRead();
|
||||||
mutex.lock();
|
}
|
||||||
|
|
||||||
next_offset = offset = new_offset;
|
next_offset = offset = new_offset;
|
||||||
SeekDone();
|
SeekDone();
|
||||||
|
Loading…
Reference in New Issue
Block a user