Added mutex in ConsoleUI to lock while using cout. Makes debug output more readable.

This commit is contained in:
bjorn.olievier 2008-03-28 18:48:53 +00:00
parent afde4da532
commit 10d0ece3cb
2 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,8 @@ ConsoleUI::~ConsoleUI()
void ConsoleUI::Print(std::tstring s)
{
boost::mutex::scoped_lock lock(mutex);
tcout << "\n*******************************\n\n";
std::tcout << s;
tcout << "\n*******************************\n" << endl;
@ -89,6 +91,8 @@ void ConsoleUI::Run()
void ConsoleUI::PrintCommands()
{
boost::mutex::scoped_lock lock(mutex);
tcout << "Commands:\n";
tcout << "\tp [file]: play file (enter full path)\n";
tcout << "\ts [n]: stop playing n-th file\n";

View File

@ -39,6 +39,8 @@
#include <vector>
#include <boost/thread/mutex.hpp>
#include "Transport.h"
#include "DummyAudioEventHandler.h"
@ -75,6 +77,8 @@ private: bool shouldQuit;
private: Transport transport;
private: DummyAudioEventHandler audioEventHandler;
private: boost::mutex mutex;
private: void ShutDown();
public: static DWORD WINAPI ThreadRun(LPVOID param);
};