Rearranged the logic

This commit is contained in:
Kayne Ruse
2013-08-24 23:20:43 +10:00
parent 0a0b61287e
commit 7458962ad4
12 changed files with 234 additions and 121 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef MAILBOX_HPP_
#define MAILBOX_HPP_
#include "SDL/SDL_thread.h"
#include <deque>
#include <string>
//Thread safe mailbox
class MailBox {
public:
MailBox();
~MailBox();
std::string PushIn(std::string);
std::string PeekIn();
std::string PopIn();
std::string PushOut(std::string);
std::string PeekOut();
std::string PopOut();
private:
std::deque<std::string> input;
std::deque<std::string> output;
SDL_mutex* inLock = nullptr;
SDL_mutex* outLock = nullptr;
};
#endif