Panda3D
Loading...
Searching...
No Matches
configVariableFilename.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file configVariableFilename.cxx
10 * @author drose
11 * @date 2004-11-22
12 */
13
16
17/**
18 * Recopies the config variable into the Filename for returning its value.
19 */
20void ConfigVariableFilename::
21reload_cache() {
22 // NB. MSVC doesn't guarantee that this mutex is initialized in a
23 // thread-safe manner. But chances are that the first time this is called
24 // is at static init time, when there is no risk of data races.
25 static MutexImpl lock;
26 lock.lock();
27
28 // We check again for cache validity since another thread may have beaten
29 // us to the punch while we were waiting for the lock.
30 if (!is_cache_valid(_local_modified)) {
31 nassertv(_core != nullptr);
32 const ConfigDeclaration *decl = _core->get_declaration(0);
33
34 _cache = decl->get_filename_value();
35 mark_cache_valid(_local_modified);
36 }
37 lock.unlock();
38}
A single declaration of a config variable, typically defined as one line in a .prc file,...
Filename get_filename_value() const
Interprets the string value as a filename and returns it, with any variables expanded.
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.