mirror of
https://github.com/libretro/Play-.git
synced 2025-01-27 11:41:46 +00:00
38e1632c11
git-svn-id: http://svn.purei.org/purei/trunk@180 b36208d7-6611-0410-8bec-b1987f11c4a2
32 lines
700 B
C++
32 lines
700 B
C++
#ifndef _MAILBOX_H_
|
|
#define _MAILBOX_H_
|
|
|
|
#include <functional>
|
|
#include <deque>
|
|
#include <boost/thread.hpp>
|
|
|
|
class CMailBox
|
|
{
|
|
public:
|
|
CMailBox();
|
|
virtual ~CMailBox();
|
|
|
|
typedef std::tr1::function<void ()> FunctionType;
|
|
|
|
void SendCall(const FunctionType&);
|
|
|
|
bool IsPending() const;
|
|
void ReceiveCall();
|
|
void WaitForCall();
|
|
|
|
private:
|
|
typedef std::deque<FunctionType> FunctionCallQueue;
|
|
|
|
FunctionCallQueue m_calls;
|
|
boost::mutex m_waitMutex;
|
|
boost::condition m_callFinished;
|
|
boost::condition m_waitCondition;
|
|
};
|
|
|
|
#endif
|