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:
parent
61e8df913d
commit
c29d23b4c3
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user