event/Call, ...: use wait() with predicate

This commit is contained in:
Max Kellermann
2019-05-07 20:01:45 +02:00
parent 72fc117393
commit 973c87b351
12 changed files with 20 additions and 35 deletions

View File

@@ -92,8 +92,7 @@ void
ProxyInputStream::Seek(std::unique_lock<Mutex> &lock,
offset_type new_offset)
{
while (!input)
set_input_cond.wait(lock);
set_input_cond.wait(lock, [this]{ return !!input; });
input->Seek(lock, new_offset);
CopyAttributes();
@@ -124,8 +123,7 @@ size_t
ProxyInputStream::Read(std::unique_lock<Mutex> &lock,
void *ptr, size_t read_size)
{
while (!input)
set_input_cond.wait(lock);
set_input_cond.wait(lock, [this]{ return !!input; });
size_t nbytes = input->Read(lock, ptr, read_size);
CopyAttributes();