Remove FifoQueue iterator and RemoveThreadsafeEvents.

No point making a whole iterator class for the sake of a function that
doesn't need to exist.
This commit is contained in:
comex 2013-09-22 22:11:24 -04:00
parent 0a093cf1b9
commit c8c83f7b8a
4 changed files with 1 additions and 52 deletions

View File

@ -92,43 +92,6 @@ public:
m_write_ptr = m_read_ptr = new ElementPtr(); m_write_ptr = m_read_ptr = new ElementPtr();
} }
private:
class ElementPtr;
public:
class iterator
{
public:
iterator() {}
bool operator==(iterator other) { return other.m_pp == m_pp; }
bool operator!=(iterator other) { return !(*this == other); }
T* operator->() { return &**this; }
T& operator*() { return (*m_pp)->current; }
void operator++() { m_pp = &(*m_pp)->next; }
protected:
iterator(ElementPtr *volatile *pp) : m_pp(pp) {}
ElementPtr *volatile *m_pp;
friend class FifoQueue<T, NeedSize>;
};
iterator begin()
{
return iterator(&m_read_ptr);
}
iterator end()
{
return iterator(&m_write_ptr->next);
}
iterator erase(iterator itr)
{
ElementPtr *elp = *itr.m_pp;
*itr.m_pp = AtomicLoadAcquire(elp->next);
delete elp;
return itr;
}
private: private:
// stores a pointer to element // stores a pointer to element
// and a pointer to the next ElementPtr // and a pointer to the next ElementPtr

View File

@ -319,21 +319,9 @@ void RemoveEvent(int event_type)
} }
} }
void RemoveThreadsafeEvent(int event_type)
{
std::lock_guard<std::mutex> lk(tsWriteLock);
for (Common::FifoQueue<BaseEvent, false>::iterator itr = tsQueue.begin(); itr != tsQueue.end(); ++itr)
{
if (itr->type == event_type)
{
itr = tsQueue.erase(itr);
}
}
}
void RemoveAllEvents(int event_type) void RemoveAllEvents(int event_type)
{ {
RemoveThreadsafeEvent(event_type); MoveEvents();
RemoveEvent(event_type); RemoveEvent(event_type);
} }

View File

@ -49,7 +49,6 @@ void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata=0);
// We only permit one event of each type in the queue at a time. // We only permit one event of each type in the queue at a time.
void RemoveEvent(int event_type); void RemoveEvent(int event_type);
void RemoveThreadsafeEvent(int event_type);
void RemoveAllEvents(int event_type); void RemoveAllEvents(int event_type);
bool IsScheduled(int event_type); bool IsScheduled(int event_type);
void Advance(); void Advance();

View File

@ -135,7 +135,6 @@ void Init()
void Reset(bool _bHard) void Reset(bool _bHard)
{ {
CoreTiming::RemoveAllEvents(enque_reply); CoreTiming::RemoveAllEvents(enque_reply);
u32 i; u32 i;