NetPlay: completely redone - should be somewhat usable when using Single Core and DSP LLE Plugin.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5425 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-05-01 19:10:35 +00:00
parent 1796cbc917
commit a6d6d27328
16 changed files with 1544 additions and 2497 deletions

View File

@ -0,0 +1,47 @@
#ifndef _LOCKINGQUEUE_H_
#define _LOCKINGQUEUE_H_
#include "Thread.h"
#include <queue>
// i should make one of those single reader/ single writer queues
template <typename T>
class LockingQueue
{
public:
size_t Size()
{
m_crit.Enter();
const size_t s = m_queue.size();
m_crit.Leave();
return s;
}
void Push(const T& t)
{
m_crit.Enter();
m_queue.push(t);
m_crit.Leave();
}
bool Pop(T& t)
{
m_crit.Enter();
if (m_queue.size())
{
t = m_queue.front();
m_queue.pop();
m_crit.Leave();
return true;
}
m_crit.Leave();
return false;
}
private:
std::queue<T> m_queue;
Common::CriticalSection m_crit;
};
#endif