Parcourir la source

Fixed semaphore timeout on Linux. Thanks @jsimmons for bug report.

bkaradzic il y a 13 ans
Parent
commit
857c58cd88
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      include/bx/sem.h

+ 3 - 2
include/bx/sem.h

@@ -52,8 +52,9 @@ namespace bx
 			}
 
 			timespec ts;
-			ts.tv_sec = _msecs/1000;
-			ts.tv_nsec = (_msecs%1000)*1000;
+			clock_gettime(CLOCK_REALTIME, &ts);
+			ts.tv_sec += _msecs/1000;
+			ts.tv_nsec += (_msecs%1000)*1000;
 			return 0 == sem_timedwait(&m_handle, &ts);
 #endif // BX_PLATFORM_
 		}