This repository has been archived on 2026-04-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Tortuga/server/mail_box.hpp
T
2013-08-29 19:57:25 +10:00

29 lines
496 B
C++

#ifndef MAILBOX_HPP_
#define MAILBOX_HPP_
#include "SDL/SDL_thread.h"
#include <deque>
#include <string>
//Thread safe messaging system
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