mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Merge branch 'release/1.9.x'
This commit is contained in:
commit
6f168446d0
@ -25,6 +25,8 @@ This issue fixes several bugs that were still found in 1.9.2.
|
||||
* Work around Cg bug generating invalid ASM for saturated tex loads
|
||||
* Fix issues with certain Cg shader inputs in DX9
|
||||
* Support uint8 index buffers in DX9
|
||||
* Fix occasional frame lag when loading a big model asynchronously
|
||||
* Fix race condition reading string config var
|
||||
|
||||
------------------------ RELEASE 1.9.2 ------------------------
|
||||
|
||||
|
@ -19,8 +19,16 @@
|
||||
*/
|
||||
void ConfigVariableFilename::
|
||||
reload_cache() {
|
||||
// NB. MSVC doesn't guarantee that this mutex is initialized in a
|
||||
// thread-safe manner. But chances are that the first time this is called
|
||||
// is at static init time, when there is no risk of data races.
|
||||
static MutexImpl lock;
|
||||
lock.acquire();
|
||||
|
||||
// We check again for cache validity since another thread may have beaten
|
||||
// us to the punch while we were waiting for the lock.
|
||||
if (!is_cache_valid(_local_modified)) {
|
||||
nassertv(_core != (ConfigVariableCore *)NULL);
|
||||
mark_cache_valid(_local_modified);
|
||||
|
||||
const ConfigDeclaration *decl = _core->get_declaration(0);
|
||||
const ConfigPage *page = decl->get_page();
|
||||
@ -31,4 +39,8 @@ reload_cache() {
|
||||
|
||||
_cache = Filename::expand_from(decl->get_string_value());
|
||||
ExecutionEnvironment::clear_shadow("THIS_PRC_DIR");
|
||||
|
||||
mark_cache_valid(_local_modified);
|
||||
}
|
||||
lock.release();
|
||||
}
|
||||
|
@ -127,8 +127,7 @@ INLINE const string &ConfigVariableString::
|
||||
get_value() const {
|
||||
TAU_PROFILE("const string &ConfigVariableString::get_value() const", " ", TAU_USER);
|
||||
if (!is_cache_valid(_local_modified)) {
|
||||
mark_cache_valid(((ConfigVariableString *)this)->_local_modified);
|
||||
((ConfigVariableString *)this)->_cache = get_string_value();
|
||||
((ConfigVariableString *)this)->reload_cache();
|
||||
}
|
||||
return _cache;
|
||||
}
|
||||
|
@ -12,3 +12,24 @@
|
||||
*/
|
||||
|
||||
#include "configVariableString.h"
|
||||
|
||||
/**
|
||||
* Refreshes the variable's cached value.
|
||||
*/
|
||||
void ConfigVariableString::
|
||||
reload_cache() {
|
||||
// NB. MSVC doesn't guarantee that this mutex is initialized in a
|
||||
// thread-safe manner. But chances are that the first time this is called
|
||||
// is at static init time, when there is no risk of data races.
|
||||
static MutexImpl lock;
|
||||
lock.acquire();
|
||||
|
||||
// We check again for cache validity since another thread may have beaten
|
||||
// us to the punch while we were waiting for the lock.
|
||||
if (!is_cache_valid(_local_modified)) {
|
||||
_cache = get_string_value();
|
||||
mark_cache_valid(_local_modified);
|
||||
}
|
||||
|
||||
lock.release();
|
||||
}
|
||||
|
@ -49,6 +49,9 @@ PUBLISHED:
|
||||
INLINE string get_word(size_t n) const;
|
||||
INLINE void set_word(size_t n, const string &value);
|
||||
|
||||
private:
|
||||
void reload_cache();
|
||||
|
||||
private:
|
||||
AtomicAdjust::Integer _local_modified;
|
||||
string _cache;
|
||||
|
@ -310,13 +310,24 @@ emergency_read_only() {
|
||||
*/
|
||||
void BamCache::
|
||||
consider_flush_index() {
|
||||
ReMutexHolder holder(_lock);
|
||||
#if defined(HAVE_THREADS) || defined(DEBUG_THREADS)
|
||||
if (!_lock.try_acquire()) {
|
||||
// If we can't grab the lock, no big deal. We don't want to hold up
|
||||
// the frame waiting for a cache operation. We can try again later.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_index_stale_since != 0) {
|
||||
int elapsed = (int)time(NULL) - (int)_index_stale_since;
|
||||
if (elapsed > _flush_time) {
|
||||
flush_index();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_THREADS) || defined(DEBUG_THREADS)
|
||||
_lock.release();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user