diff --git a/lib/include/srslte/common/tti_sempahore.h b/lib/include/srslte/common/tti_sempahore.h index b8c304e09..3c2e782fd 100644 --- a/lib/include/srslte/common/tti_sempahore.h +++ b/lib/include/srslte/common/tti_sempahore.h @@ -33,7 +33,6 @@ template class tti_semaphore { private: - const uint32_t max_timeout_ms = 60000; // 1 minute std::mutex mutex; std::condition_variable cvar; std::deque fifo; @@ -41,17 +40,9 @@ private: public: void wait(T id) { - 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() && fifo.front() != id && !expired) { - expired = (cvar.wait_until(lock, expire_time) == std::cv_status::timeout); - } - - if (expired) { - perror("TTI semaphore wait timeout"); + std::unique_lock lock(mutex); + while (!fifo.empty() && fifo.front() != id) { + cvar.wait(lock); } } @@ -68,7 +59,12 @@ public: cvar.notify_all(); } - void wait_all() { wait(-1); } + void wait_all() + { + while (!fifo.empty()) { + wait(fifo.front()); + } + } }; } // namespace srslte