created locks abstraction
[physics.git] / src / debug.cpp
index e838c8e..5c8baeb 100644 (file)
@@ -22,32 +22,28 @@ using std::cerr;
 using std::cout;
 using std::endl;
 
-#include <SDL/SDL.h>
+#include "locks/Mutex.h"
+#include "locks/Autolock.h"
 
 /// ***** Public Methods *****
 
-SDL_mutex* muDPF = NULL;
+Mutex muDPF;
 
 void DPF(int level, const char* pstr)
 {
-    // lock
-    SDL_mutexP( muDPF );
+    Autolock lock(muDPF);
 
     cout << pstr << endl;
-
-    //unlock
-    SDL_mutexV( muDPF );
 }
 
 void debug::init()
 {
-    muDPF = SDL_CreateMutex();
+    muDPF.init();
 }
 
 void debug::clean()
 {
-    SDL_DestroyMutex( muDPF );
-    muDPF = NULL;
+    muDPF.clean();
 }
 
 /// ***** Private Methods *****