input/buffering: move code to RunThreadLocked()
This commit is contained in:
parent
19e4672a54
commit
302c0515b7
@ -134,13 +134,9 @@ BufferingInputStream::FindFirstHole() const noexcept
|
||||
return INVALID_OFFSET;
|
||||
}
|
||||
|
||||
void
|
||||
BufferingInputStream::RunThread() noexcept
|
||||
inline void
|
||||
BufferingInputStream::RunThreadLocked(std::unique_lock<Mutex> &lock) noexcept
|
||||
{
|
||||
SetThreadName("buffering");
|
||||
|
||||
std::unique_lock<Mutex> lock(mutex);
|
||||
|
||||
while (!stop) {
|
||||
if (seek) {
|
||||
try {
|
||||
@ -256,6 +252,16 @@ BufferingInputStream::RunThread() noexcept
|
||||
} else
|
||||
wake_cond.wait(lock);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BufferingInputStream::RunThread() noexcept
|
||||
{
|
||||
SetThreadName("buffering");
|
||||
|
||||
std::unique_lock<Mutex> lock(mutex);
|
||||
|
||||
RunThreadLocked(lock);
|
||||
|
||||
/* clear the "input" attribute while holding the mutex */
|
||||
auto _input = std::move(input);
|
||||
|
@ -88,6 +88,7 @@ protected:
|
||||
private:
|
||||
size_t FindFirstHole() const noexcept;
|
||||
|
||||
void RunThreadLocked(std::unique_lock<Mutex> &lock) noexcept;
|
||||
void RunThread() noexcept;
|
||||
|
||||
/* virtual methods from class InputStreamHandler */
|
||||
|
Loading…
Reference in New Issue
Block a user