attempt to protect paranoid_clock from multithread

This commit is contained in:
David Rose 2007-06-07 03:34:08 +00:00
parent 30c30438d5
commit 97f794be0e
2 changed files with 7 additions and 0 deletions

View File

@ -94,6 +94,10 @@ double TrueClock::
get_short_time() {
double time;
if (_paranoid_clock) {
_lock.lock();
}
if (_has_high_res) {
// Use the high-resolution clock. This is of questionable value,
// since (a) on some OS's and hardware, the low 24 bits can
@ -123,6 +127,7 @@ get_short_time() {
// Check for rollforwards, rollbacks, and compensate for Speed
// Gear type programs by verifying against the time of day clock.
time = correct_time(time);
_lock.release();
}
return time;

View File

@ -22,6 +22,7 @@
#include "pandabase.h"
#include "typedef.h"
#include "pdeque.h"
#include "mutexImpl.h"
////////////////////////////////////////////////////////////////////
// Class : TrueClock
@ -100,6 +101,7 @@ protected:
CC_speed_up,
};
ChaseClock _chase_clock;
MutexImpl _lock;
#endif // WIN32
};