Panda3D
configVariableBool.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 configVariableBool.cxx
10  * @author drose
11  * @date 2004-10-20
12  */
13 
14 #include "configVariableBool.h"
15 
16 /**
17  * Refreshes the cached value.
18  */
19 void ConfigVariableBool::
20 reload_value() const {
21  // NB. MSVC doesn't guarantee that this mutex is initialized in a
22  // thread-safe manner. But chances are that the first time this is called
23  // is at static init time, when there is no risk of data races.
24  static MutexImpl lock;
25  lock.lock();
26 
27  // We check again for cache validity since another thread may have beaten
28  // us to the punch while we were waiting for the lock.
29  if (!is_cache_valid(_local_modified)) {
30  _cache = get_bool_word(0);
31  mark_cache_valid(_local_modified);
32  }
33 
34  lock.unlock();
35 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...