input/thread: use notify_one() instead of notify_all()

There's only ever one waiter, and notify_one() may be faster than
notify_all().
This commit is contained in:
Max Kellermann 2024-07-29 23:08:48 +02:00
parent 61e8df913d
commit c29d23b4c3

View File

@ -131,7 +131,7 @@ ThreadInputStream::Read(std::unique_lock<Mutex> &lock,
size_t nbytes = std::min(dest.size(), r.size()); size_t nbytes = std::min(dest.size(), r.size());
memcpy(dest.data(), r.data(), nbytes); memcpy(dest.data(), r.data(), nbytes);
buffer.Consume(nbytes); buffer.Consume(nbytes);
wake_cond.notify_all(); wake_cond.notify_one();
offset += nbytes; offset += nbytes;
return nbytes; return nbytes;
} }