decoder/Control: remove attribute client_is_waiting
This optimization is useless because sane pthread_cond_signal() implementations check the number of waiters and do not invoke a system call if there are none.
This commit is contained in:
src/decoder
@ -145,7 +145,6 @@ DecoderBridge::FlushChunk() noexcept
|
|||||||
dc.pipe->Push(std::move(chunk));
|
dc.pipe->Push(std::move(chunk));
|
||||||
|
|
||||||
const std::lock_guard<Mutex> protect(dc.mutex);
|
const std::lock_guard<Mutex> protect(dc.mutex);
|
||||||
if (dc.client_is_waiting)
|
|
||||||
dc.client_cond.notify_one();
|
dc.client_cond.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,13 +43,7 @@ DecoderControl::~DecoderControl() noexcept
|
|||||||
void
|
void
|
||||||
DecoderControl::WaitForDecoder(std::unique_lock<Mutex> &lock) noexcept
|
DecoderControl::WaitForDecoder(std::unique_lock<Mutex> &lock) noexcept
|
||||||
{
|
{
|
||||||
assert(!client_is_waiting);
|
|
||||||
client_is_waiting = true;
|
|
||||||
|
|
||||||
client_cond.wait(lock);
|
client_cond.wait(lock);
|
||||||
|
|
||||||
assert(client_is_waiting);
|
|
||||||
client_is_waiting = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -111,13 +111,6 @@ private:
|
|||||||
bool quit;
|
bool quit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Is the client currently waiting for the DecoderThread? If
|
|
||||||
* false, the DecoderThread may omit invoking Cond::signal(),
|
|
||||||
* reducing the number of system calls.
|
|
||||||
*/
|
|
||||||
bool client_is_waiting = false;
|
|
||||||
|
|
||||||
bool seek_error;
|
bool seek_error;
|
||||||
bool seekable;
|
bool seekable;
|
||||||
SongTime seek_time;
|
SongTime seek_time;
|
||||||
|
Reference in New Issue
Block a user