mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
attempt to protect paranoid_clock from multithread
This commit is contained in:
parent
30c30438d5
commit
97f794be0e
@ -94,6 +94,10 @@ double TrueClock::
|
|||||||
get_short_time() {
|
get_short_time() {
|
||||||
double time;
|
double time;
|
||||||
|
|
||||||
|
if (_paranoid_clock) {
|
||||||
|
_lock.lock();
|
||||||
|
}
|
||||||
|
|
||||||
if (_has_high_res) {
|
if (_has_high_res) {
|
||||||
// Use the high-resolution clock. This is of questionable value,
|
// Use the high-resolution clock. This is of questionable value,
|
||||||
// since (a) on some OS's and hardware, the low 24 bits can
|
// 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
|
// Check for rollforwards, rollbacks, and compensate for Speed
|
||||||
// Gear type programs by verifying against the time of day clock.
|
// Gear type programs by verifying against the time of day clock.
|
||||||
time = correct_time(time);
|
time = correct_time(time);
|
||||||
|
_lock.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return time;
|
return time;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
#include "typedef.h"
|
#include "typedef.h"
|
||||||
#include "pdeque.h"
|
#include "pdeque.h"
|
||||||
|
#include "mutexImpl.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : TrueClock
|
// Class : TrueClock
|
||||||
@ -100,6 +101,7 @@ protected:
|
|||||||
CC_speed_up,
|
CC_speed_up,
|
||||||
};
|
};
|
||||||
ChaseClock _chase_clock;
|
ChaseClock _chase_clock;
|
||||||
|
MutexImpl _lock;
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user