X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=blobdiff_plain;f=src%2Fdebug.cpp;h=909a54fb057284792b9dd61eb5cc56aebd7c1498;hp=c1557857185e4791e137255467245083d21b804c;hb=2a02c4bb2ab611952ac783eea9b93a1d44790dd7;hpb=4e77f48b331eeab55f2dd58436fe47b734314bdc diff --git a/src/debug.cpp b/src/debug.cpp index c155785..909a54f 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -22,11 +22,31 @@ using std::cerr; using std::cout; using std::endl; +#include + /// ***** Public Methods ***** +SDL_mutex* muDPF = NULL; + void DPF(int level, const char* pstr) { - cout << pstr << endl; + // lock + SDL_mutexP( muDPF ); + + cout << pstr << endl; + + //unlock + SDL_mutexV( muDPF ); +} + +void debug::init() +{ + muDPF = SDL_CreateMutex(); +} + +void debug::clean() +{ + SDL_DestroyMutex( muDPF ); } /// ***** Private Methods *****