54 bool doWakeup =
false;
55 if (myTimerQueue.empty() ||
56 offsetInMs < myTimerQueue.getTimeout())
61 TimerId id = myTimerQueue.addRelative(t, offsetInMs);
77 if (myTimerQueue.cancel(
id))
89 while (!messageAvailableNoLock())
91 if (myTimerQueue.empty())
93 myCondition.wait(lock);
97 myCondition.wait_for(lock, std::chrono::milliseconds(myTimerQueue.getTimeout()));
101 while (myTimerQueue.available())
103 myList.push_back(myTimerQueue.getNext());
111 T firstMessage = myList.front();
123 myTimerQueue.clear();
131 return myFifoSize + myTimerSize;
136 return myFifoSize + myTimerSize == 0;
142 return messageAvailableNoLock();
166 bool messageAvailableNoLock()
168 return myFifoSize > 0 || myTimerQueue.available();
173 myCondition.notify_one();
176 std::deque<T> myList;
178 CancelableTimerQueue<T> myTimerQueue;
180 unsigned long myFifoSize;
181 unsigned long myTimerSize;
#define resip_assert(x)
This file needs to work for both C and C++ code.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Interface for providing metrics on FIFOs, primarily used by CongestionManager.
CancelableTimerQueue< T >::Id TimerId
virtual time_t getTimeDepth() const
Returns the difference in time between the youngest and oldest item in the FIFO in seconds.
ValueFifo(const Data &name)
unsigned int size() const
virtual time_t expectedWaitTimeMilliSec() const
Returns the expected time it will take to service all messages currently in the queue (in milli-secon...
virtual time_t averageServiceTimeMicroSec() const
Returns the average time it takes for individual messages to be serviced (in micro-seconds)
TimerId addDelayMs(const T &t, int offsetInMs)
virtual size_t getCountDepth() const
Returns the number of elements in the FIFO.
dcm! – add UnusedChecking(_enum) below;
std::mutex Mutex
A semaphore that can be locked by only one thread at a time.
std::unique_lock< Mutex > Lock
A convenience class to lock a Lockable (such as a Mutex) on object creation, and unlock on destructio...
std::condition_variable Condition
A condition variable that can be signaled or waited on, wraps POSIX/Windows implementations depending...