projects
/
physics.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip: more thread safety
[physics.git]
/
src
/
debug.cpp
diff --git
a/src/debug.cpp
b/src/debug.cpp
index
8c13cbe
..
e838c8e
100644
(file)
--- a/
src/debug.cpp
+++ b/
src/debug.cpp
@@
-17,14
+17,37
@@
#include "debug.h"
#include "debug.h"
-/// ***** Private Method Headers *****
-/// ***** Private Variables *****
+#include <iostream>
+using std::cerr;
+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 );
+ muDPF = NULL;
}
/// ***** Private Methods *****
}
/// ***** Private Methods *****