diff --git a/lib/include/srslte/common/tti_sempahore.h b/lib/include/srslte/common/tti_sempahore.h index 2fa08eac3..b8c304e09 100644 --- a/lib/include/srslte/common/tti_sempahore.h +++ b/lib/include/srslte/common/tti_sempahore.h @@ -46,7 +46,7 @@ public: std::chrono::system_clock::time_point expire_time = std::chrono::system_clock::now(); expire_time += std::chrono::milliseconds(max_timeout_ms); - while (fifo.front() != id && !expired) { + while (!fifo.empty() && fifo.front() != id && !expired) { expired = (cvar.wait_until(lock, expire_time) == std::cv_status::timeout); } @@ -68,21 +68,7 @@ public: cvar.notify_all(); } - void wait_all() - { - bool expired = false; - std::unique_lock lock(mutex); - std::chrono::system_clock::time_point expire_time = std::chrono::system_clock::now(); - expire_time += std::chrono::milliseconds(max_timeout_ms); - - while (!fifo.empty() && !expired) { - expired = (cvar.wait_until(lock, expire_time) == std::cv_status::timeout); - } - - if (expired) { - perror("TTI semaphore wait all expired"); - } - } + void wait_all() { wait(-1); } }; } // namespace srslte