diff options
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h index 12291cc..9c9a4a7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h @@ -55,9 +55,13 @@ namespace WTF { bool waitForMessage(DataType&); template<typename Predicate> MessageQueueWaitResult waitForMessageFilteredWithTimeout(DataType&, Predicate&, double absoluteTime); - void kill(); + + template<typename Predicate> + void removeIf(Predicate&); bool tryGetMessage(DataType&); + + void kill(); bool killed() const; // The result of isEmpty() is only valid if no other thread is manipulating the queue at the same time. @@ -149,6 +153,17 @@ namespace WTF { } template<typename DataType> + template<typename Predicate> + inline void MessageQueue<DataType>::removeIf(Predicate& predicate) + { + MutexLocker lock(m_mutex); + DequeConstIterator<DataType> found = m_queue.end(); + while ((found = m_queue.findIf(predicate)) != m_queue.end()) { + m_queue.remove(found); + } + } + + template<typename DataType> inline bool MessageQueue<DataType>::isEmpty() { MutexLocker lock(m_mutex); |