Explorar el Código

Mutex fixed, bug in Cond

mikymod hace 12 años
padre
commit
9c735a3e2f
Se han modificado 2 ficheros con 6 adiciones y 2 borrados
  1. 5 1
      src/os/win/Cond.cpp
  2. 1 1
      src/os/win/Mutex.cpp

+ 5 - 1
src/os/win/Cond.cpp

@@ -49,7 +49,11 @@ void Cond::signal()
 void Cond::wait(Mutex& mutex)
 {
 	CRITICAL_SECTION cs = mutex.handle();
-	SleepConditionVariableCS(&m_cond, &cs, INFINITE);
+	// Deadlock encountered, maybe the problem is INFINITE
+	// because it can not be set in a thread where a windows is created
+	// or CoInitialize is called.
+	SleepConditionVariableCS(&m_cond, &cs, 5000);
+	//m_cond->ptr == NULL 
 }
 
 } // namespace os

+ 1 - 1
src/os/win/Mutex.cpp

@@ -47,7 +47,7 @@ Mutex::~Mutex()
 //-----------------------------------------------------------------------------
 void Mutex::lock()
 {
-    EnterCriticalSection(&m_cs); 
+    TryEnterCriticalSection(&m_cs); 
 }
 
 //-----------------------------------------------------------------------------