projects
/
physics.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added some thread safty ... much more still needed
[physics.git]
/
src
/
debug.cpp
diff --git
a/src/debug.cpp
b/src/debug.cpp
index
c155785
..
909a54f
100644
(file)
--- a/
src/debug.cpp
+++ b/
src/debug.cpp
@@
-22,11
+22,31
@@
using std::cerr;
using std::cout;
using std::endl;
using std::cout;
using std::endl;
+#include <SDL/SDL.h>
+
/// ***** Public Methods *****
/// ***** Public Methods *****
+SDL_mutex* muDPF = NULL;
+
void DPF(int level, const char* pstr)
{
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 *****
}
/// ***** Private Methods *****