Moved the thread out of the NetworkQueue class

This commit is contained in:
Kayne Ruse
2013-11-09 20:04:06 +11:00
parent bf15a5d957
commit c2941cd3e8
4 changed files with 115 additions and 145 deletions
+6 -15
View File
@@ -1,7 +1,6 @@
#ifndef NETWORKQUEUE_HPP_
#define NETWORKQUEUE_HPP_
#include "udp_network_utility.hpp"
#include "network_packet.hpp"
#include "SDL/SDL_thread.h"
@@ -10,28 +9,20 @@
class NetworkQueue {
public:
NetworkQueue() = default;
~NetworkQueue() = default;
void Init(UDPNetworkUtility*);
void Quit();
void Kill();
NetworkQueue();
~NetworkQueue();
NetworkPacket Push(NetworkPacket);
NetworkPacket Peek();
NetworkPacket Pop();
void Flush();
int Size();
SDL_sem* GetLock() const { return lock; }
private:
friend int networkQueueThread(void*);
void ResetMembers();
bool running = false;
UDPNetworkUtility* netUtil = nullptr;
SDL_sem* lock = nullptr;
SDL_Thread* thread = nullptr;
std::deque<NetworkPacket> queue;
SDL_sem* lock;
};
#endif