SIMPLE_THREADS_NO_MUTEX -> LightMutex

This commit is contained in:
David Rose 2008-10-08 23:23:40 +00:00
parent 900cc46683
commit d4c2c9858d
177 changed files with 2211 additions and 1044 deletions

View File

@ -713,18 +713,6 @@
// overhead over plain single-threaded code.
#define SIMPLE_THREADS
// If you are using SIMPLE_THREADS, you might further wish to disable
// mutexes altogether. In this mode, mutexes are compiled out (they
// become a no-op), and the only context switches happen at explicit
// calls to Thread::force_yield(), consider_yield(), and sleep(), as
// well as calls to ConditionVar::wait(), and certain I/O operations.
// This gives you control over when the context switch happens, and
// may make mutexes unnecessary, if you are somewhat careful in your
// code design. Disabling mutexes saves a tiny bit of runtime and
// memory overhead. NOT RECOMMENDED! Many internal Panda functions
// aren't quite secure enough to enable this mode for now.
#define SIMPLE_THREADS_NO_MUTEX
// Whether threading is defined or not, you might want to validate the
// thread and synchronization operations. With threading enabled,
// defining this will also enable deadlock detection and logging.

View File

@ -299,7 +299,6 @@ $[cdefine HAVE_THREADS]
/* Define if we want to use fast, user-space simulated threads. */
$[cdefine SIMPLE_THREADS]
$[cdefine SIMPLE_THREADS_NO_MUTEX]
/* Define to enable deadlock detection, mutex recursion checks, etc. */
$[cdefine DEBUG_THREADS]

View File

@ -32,7 +32,7 @@ is_open() const {
////////////////////////////////////////////////////////////////////
INLINE int GlobalMilesManager::
get_num_samples() const {
MutexHolder holder(_samples_lock);
LightMutexHolder holder(_samples_lock);
return _samples.size();
}
@ -44,6 +44,6 @@ get_num_samples() const {
////////////////////////////////////////////////////////////////////
INLINE int GlobalMilesManager::
get_num_sequences() const {
MutexHolder holder(_sequences_lock);
LightMutexHolder holder(_sequences_lock);
return _sequences.size();
}

View File

@ -16,7 +16,7 @@
#ifdef HAVE_RAD_MSS //[
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "milesAudioManager.h"
#include "milesAudioSample.h"
#include "milesAudioSequence.h"
@ -50,7 +50,7 @@ GlobalMilesManager() :
////////////////////////////////////////////////////////////////////
void GlobalMilesManager::
add_manager(MilesAudioManager *manager) {
MutexHolder holder(_managers_lock);
LightMutexHolder holder(_managers_lock);
_managers.insert(manager);
if (!_is_open) {
open_api();
@ -66,7 +66,7 @@ add_manager(MilesAudioManager *manager) {
////////////////////////////////////////////////////////////////////
void GlobalMilesManager::
remove_manager(MilesAudioManager *manager) {
MutexHolder holder(_managers_lock);
LightMutexHolder holder(_managers_lock);
_managers.erase(manager);
if (_managers.empty() && _is_open) {
close_api();
@ -81,7 +81,7 @@ remove_manager(MilesAudioManager *manager) {
////////////////////////////////////////////////////////////////////
void GlobalMilesManager::
cleanup() {
MutexHolder holder(_managers_lock);
LightMutexHolder holder(_managers_lock);
Managers::iterator mi;
for (mi = _managers.begin(); mi != _managers.end(); ++mi) {
(*mi)->cleanup();
@ -105,7 +105,7 @@ cleanup() {
////////////////////////////////////////////////////////////////////
bool GlobalMilesManager::
get_sample(HSAMPLE &sample, size_t &index, MilesAudioSample *sound) {
MutexHolder holder(_samples_lock);
LightMutexHolder holder(_samples_lock);
for (size_t i = 0; i < _samples.size(); ++i) {
SampleData &smp = _samples[i];
@ -146,7 +146,7 @@ get_sample(HSAMPLE &sample, size_t &index, MilesAudioSample *sound) {
////////////////////////////////////////////////////////////////////
void GlobalMilesManager::
release_sample(size_t index, MilesAudioSample *sound) {
MutexHolder holder(_samples_lock);
LightMutexHolder holder(_samples_lock);
nassertv(index < _samples.size());
SampleData &smp = _samples[index];
@ -172,7 +172,7 @@ release_sample(size_t index, MilesAudioSample *sound) {
////////////////////////////////////////////////////////////////////
bool GlobalMilesManager::
get_sequence(HSEQUENCE &sequence, size_t &index, MilesAudioSequence *sound) {
MutexHolder holder(_sequences_lock);
LightMutexHolder holder(_sequences_lock);
for (size_t i = 0; i < _sequences.size(); ++i) {
SequenceData &seq = _sequences[i];
@ -212,7 +212,7 @@ get_sequence(HSEQUENCE &sequence, size_t &index, MilesAudioSequence *sound) {
////////////////////////////////////////////////////////////////////
void GlobalMilesManager::
release_sequence(size_t index, MilesAudioSequence *sound) {
MutexHolder holder(_sequences_lock);
LightMutexHolder holder(_sequences_lock);
nassertv(index < _sequences.size());
SequenceData &seq = _sequences[index];

View File

@ -20,8 +20,8 @@
#include "mss.h"
#include "pset.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
#ifndef UINTa
#define UINTa U32
@ -86,7 +86,7 @@ private:
typedef pset<MilesAudioManager *> Managers;
Managers _managers;
Mutex _managers_lock;
LightMutex _managers_lock;
class SampleData {
public:
@ -96,7 +96,7 @@ private:
typedef pvector<SampleData> Samples;
Samples _samples;
Mutex _samples_lock;
LightMutex _samples_lock;
class SequenceData {
public:
@ -106,7 +106,7 @@ private:
typedef pvector<SequenceData> Sequences;
Sequences _sequences;
Mutex _sequences_lock;
LightMutex _sequences_lock;
static GlobalMilesManager *_global_ptr;
};

View File

@ -28,7 +28,7 @@
#include "nullAudioSound.h"
#include "string_utils.h"
#include "mutexHolder.h"
#include "reMutexHolder.h"
#include "lightReMutexHolder.h"
#include <algorithm>
@ -125,7 +125,7 @@ shutdown() {
////////////////////////////////////////////////////////////////////
bool MilesAudioManager::
is_valid() {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
return do_is_valid();
}
@ -136,7 +136,7 @@ is_valid() {
////////////////////////////////////////////////////////////////////
PT(AudioSound) MilesAudioManager::
get_sound(const string &file_name, bool, int) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
audio_debug("MilesAudioManager::get_sound(file_name=\""<<file_name<<"\")");
if (!do_is_valid()) {
@ -239,7 +239,7 @@ void MilesAudioManager::
uncache_sound(const string &file_name) {
audio_debug("MilesAudioManager::uncache_sound(file_name=\""
<<file_name<<"\")");
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
nassertv(do_is_valid());
Filename path = file_name;
@ -267,7 +267,7 @@ uncache_sound(const string &file_name) {
void MilesAudioManager::
clear_cache() {
audio_debug("MilesAudioManager::clear_cache()");
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
do_clear_cache();
}
@ -278,7 +278,7 @@ clear_cache() {
////////////////////////////////////////////////////////////////////
void MilesAudioManager::
set_cache_limit(unsigned int count) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
audio_debug("MilesAudioManager::set_cache_limit(count="<<count<<")");
nassertv(do_is_valid());
@ -307,7 +307,7 @@ get_cache_limit() const {
void MilesAudioManager::
set_volume(float volume) {
audio_debug("MilesAudioManager::set_volume(volume="<<volume<<")");
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
if (_volume != volume) {
_volume = volume;
// Tell our AudioSounds to adjust:
@ -336,7 +336,7 @@ get_volume() const {
void MilesAudioManager::
set_play_rate(float play_rate) {
audio_debug("MilesAudioManager::set_play_rate(play_rate="<<play_rate<<")");
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
if (_play_rate != play_rate) {
_play_rate = play_rate;
// Tell our AudioSounds to adjust:
@ -365,7 +365,7 @@ get_play_rate() const {
void MilesAudioManager::
set_active(bool active) {
audio_debug("MilesAudioManager::set_active(flag="<<active<<")");
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
if (_active != active) {
_active=active;
// Tell our AudioSounds to adjust:
@ -397,7 +397,7 @@ get_active() const {
////////////////////////////////////////////////////////////////////
void MilesAudioManager::
set_concurrent_sound_limit(unsigned int limit) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
_concurrent_sound_limit = limit;
do_reduce_sounds_playing_to(_concurrent_sound_limit);
}
@ -419,7 +419,7 @@ get_concurrent_sound_limit() const {
////////////////////////////////////////////////////////////////////
void MilesAudioManager::
reduce_sounds_playing_to(unsigned int count) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
do_reduce_sounds_playing_to(count);
}
@ -482,7 +482,7 @@ void MilesAudioManager::
release_sound(MilesAudioSound *audioSound) {
audio_debug("MilesAudioManager::release_sound(audioSound=\""
<<audioSound->get_name()<<"\"), this = " << (void *)this);
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
AudioSet::iterator ai = _sounds_on_loan.find(audioSound);
nassertv(ai != _sounds_on_loan.end());
_sounds_on_loan.erase(ai);
@ -501,7 +501,7 @@ void MilesAudioManager::
cleanup() {
audio_debug("MilesAudioManager::cleanup(), this = " << (void *)this
<< ", _cleanup_required = " << _cleanup_required);
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
if (!_cleanup_required) {
return;
}
@ -541,7 +541,7 @@ cleanup() {
////////////////////////////////////////////////////////////////////
void MilesAudioManager::
output(ostream &out) const {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
out << get_type() << ": " << _sounds_playing.size()
<< " / " << _sounds_on_loan.size() << " sounds playing / total";
}
@ -553,7 +553,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
void MilesAudioManager::
write(ostream &out) const {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
out << (*this) << "\n";
AudioSet::const_iterator ai;
@ -733,7 +733,7 @@ uncache_a_sound() {
////////////////////////////////////////////////////////////////////
void MilesAudioManager::
starting_sound(MilesAudioSound *audio) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
if (_concurrent_sound_limit) {
do_reduce_sounds_playing_to(_concurrent_sound_limit);
}
@ -749,7 +749,7 @@ starting_sound(MilesAudioSound *audio) {
////////////////////////////////////////////////////////////////////
void MilesAudioManager::
stopping_sound(MilesAudioSound *audio) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
_sounds_playing.erase(audio);
if (_hasMidiSounds && _sounds_playing.size() == 0) {
GlobalMilesManager::get_global_ptr()->force_midi_reset();

View File

@ -27,7 +27,7 @@
#include "pvector.h"
#include "thread.h"
#include "pmutex.h"
#include "reMutex.h"
#include "lightReMutex.h"
#include "conditionVar.h"
class MilesAudioSound;
@ -143,7 +143,7 @@ private:
bool _hasMidiSounds;
// This mutex protects everything above.
ReMutex _lock;
LightReMutex _lock;
bool _sounds_finished;
typedef pvector<HSTREAM> Streams;

View File

@ -17,7 +17,7 @@
#include "datagramIterator.h"
#include "bamReader.h"
#include "bamWriter.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
TypeHandle JointVertexTransform::_type_handle;
@ -137,7 +137,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
void JointVertexTransform::
compute_matrix() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_matrix_stale) {
_matrix = _joint->_initial_net_transform_inverse * _joint->_net_transform;
_matrix_stale = false;

View File

@ -19,7 +19,7 @@
#include "characterJoint.h"
#include "vertexTransform.h"
#include "pointerTo.h"
#include "pmutex.h"
#include "lightMutex.h"
////////////////////////////////////////////////////////////////////
// Class : JointVertexTransform
@ -59,7 +59,7 @@ private:
LMatrix4f _matrix;
bool _matrix_stale;
Mutex _lock;
LightMutex _lock;
public:
static void register_with_read_factory();

View File

@ -25,7 +25,7 @@
////////////////////////////////////////////////////////////////////
INLINE void CollisionSolid::
set_tangible(bool tangible) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (tangible) {
_flags |= F_tangible;
} else {
@ -45,7 +45,7 @@ set_tangible(bool tangible) {
////////////////////////////////////////////////////////////////////
INLINE bool CollisionSolid::
is_tangible() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_is_tangible();
}
@ -63,7 +63,7 @@ is_tangible() const {
////////////////////////////////////////////////////////////////////
INLINE void CollisionSolid::
set_effective_normal(const LVector3f &effective_normal) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_effective_normal = effective_normal;
_flags |= F_effective_normal;
}
@ -76,7 +76,7 @@ set_effective_normal(const LVector3f &effective_normal) {
////////////////////////////////////////////////////////////////////
INLINE void CollisionSolid::
clear_effective_normal() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_flags &= ~F_effective_normal;
}
@ -88,7 +88,7 @@ clear_effective_normal() {
////////////////////////////////////////////////////////////////////
INLINE bool CollisionSolid::
has_effective_normal() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_has_effective_normal();
}
@ -101,7 +101,7 @@ has_effective_normal() const {
////////////////////////////////////////////////////////////////////
INLINE const LVector3f &CollisionSolid::
get_effective_normal() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertr(do_has_effective_normal(), LVector3f::zero());
return _effective_normal;
}
@ -118,7 +118,7 @@ get_effective_normal() const {
////////////////////////////////////////////////////////////////////
INLINE void CollisionSolid::
set_respect_effective_normal(bool respect_effective_normal) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// For historical reasons, the bit we store is the opposite of the
// bool flag we present.
if (respect_effective_normal) {
@ -135,7 +135,7 @@ set_respect_effective_normal(bool respect_effective_normal) {
////////////////////////////////////////////////////////////////////
INLINE bool CollisionSolid::
get_respect_effective_normal() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return (_flags & F_ignore_effective_normal) == 0;
}
@ -172,7 +172,7 @@ do_has_effective_normal() const {
////////////////////////////////////////////////////////////////////
INLINE void CollisionSolid::
mark_internal_bounds_stale() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_flags |= F_internal_bounds_stale;
}
@ -186,6 +186,6 @@ mark_internal_bounds_stale() {
////////////////////////////////////////////////////////////////////
INLINE void CollisionSolid::
mark_viz_stale() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_flags |= F_viz_geom_stale;
}

View File

@ -90,7 +90,7 @@ make_cow_copy() {
////////////////////////////////////////////////////////////////////
CPT(BoundingVolume) CollisionSolid::
get_bounds() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_flags & F_internal_bounds_stale) {
((CollisionSolid *)this)->_internal_bounds = compute_internal_bounds();
((CollisionSolid *)this)->_flags &= ~F_internal_bounds_stale;
@ -105,7 +105,7 @@ get_bounds() const {
////////////////////////////////////////////////////////////////////
void CollisionSolid::
set_bounds(const BoundingVolume &bounding_volume) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
((CollisionSolid *)this)->_internal_bounds = bounding_volume.make_copy();
((CollisionSolid *)this)->_flags &= ~F_internal_bounds_stale;
}
@ -132,7 +132,7 @@ test_intersection(const CollisionEntry &) const {
////////////////////////////////////////////////////////////////////
void CollisionSolid::
xform(const LMatrix4f &mat) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if ((_flags & F_effective_normal) != 0) {
_effective_normal = _effective_normal * mat;
_effective_normal.normalize();
@ -151,7 +151,7 @@ xform(const LMatrix4f &mat) {
////////////////////////////////////////////////////////////////////
PT(PandaNode) CollisionSolid::
get_viz(const CullTraverser *, const CullTraverserData &, bool bounds_only) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if ((_flags & F_viz_geom_stale) != 0) {
if (_viz_geom == (GeomNode *)NULL) {
((CollisionSolid *)this)->_viz_geom = new GeomNode("viz");
@ -390,7 +390,7 @@ void CollisionSolid::
write_datagram(BamWriter *, Datagram &me) {
// For now, we need only 8 bits of flags. If we need to expand this
// later, we will have to increase the bam version.
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
me.add_uint8(_flags);
if ((_flags & F_effective_normal) != 0) {
_effective_normal.write_datagram(me);

View File

@ -23,8 +23,8 @@
#include "pointerTo.h"
#include "renderState.h"
#include "geomNode.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
#include "pStatCollector.h"
class CollisionHandler;
@ -143,7 +143,7 @@ private:
};
int _flags;
Mutex _lock;
LightMutex _lock;
static PStatCollector _volume_pcollector;
static PStatCollector _test_pcollector;

View File

@ -27,7 +27,7 @@
#include "pStatClient.h"
#include "pStatCollector.h"
#include "mutexHolder.h"
#include "reMutexHolder.h"
#include "lightReMutexHolder.h"
#include "cullFaceAttrib.h"
#include "string_utils.h"
#include "geomCacheManager.h"
@ -196,7 +196,7 @@ set_threading_model(const GraphicsThreadingModel &threading_model) {
<< "Danger! Creating requested render threads anyway!\n";
}
#endif // THREADED_PIPELINE
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
_threading_model = threading_model;
}
@ -210,7 +210,7 @@ GraphicsThreadingModel GraphicsEngine::
get_threading_model() const {
GraphicsThreadingModel result;
{
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
result = _threading_model;
}
return result;
@ -454,7 +454,7 @@ remove_window(GraphicsOutput *window) {
PT(GraphicsOutput) ptwin = window;
size_t count;
{
ReMutexHolder holder(_lock, current_thread);
LightReMutexHolder holder(_lock, current_thread);
if (!_windows_sorted) {
do_resort_windows();
}
@ -613,7 +613,7 @@ render_frame() {
}
{
ReMutexHolder holder(_lock, current_thread);
LightReMutexHolder holder(_lock, current_thread);
if (!_windows_sorted) {
do_resort_windows();
@ -833,7 +833,7 @@ void GraphicsEngine::
open_windows() {
Thread *current_thread = Thread::get_current_thread();
ReMutexHolder holder(_lock, current_thread);
LightReMutexHolder holder(_lock, current_thread);
if (!_windows_sorted) {
do_resort_windows();
@ -876,7 +876,7 @@ open_windows() {
void GraphicsEngine::
sync_frame() {
Thread *current_thread = Thread::get_current_thread();
ReMutexHolder holder(_lock, current_thread);
LightReMutexHolder holder(_lock, current_thread);
if (_flip_state == FS_draw) {
do_sync_frame(current_thread);
@ -895,7 +895,7 @@ sync_frame() {
void GraphicsEngine::
flip_frame() {
Thread *current_thread = Thread::get_current_thread();
ReMutexHolder holder(_lock, current_thread);
LightReMutexHolder holder(_lock, current_thread);
if (_flip_state != FS_flip) {
do_flip_frame(current_thread);
@ -933,7 +933,7 @@ flip_frame() {
////////////////////////////////////////////////////////////////////
bool GraphicsEngine::
extract_texture_data(Texture *tex, GraphicsStateGuardian *gsg) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
string draw_name = gsg->get_threading_model().get_draw_name();
if (draw_name.empty()) {
@ -994,7 +994,7 @@ bool GraphicsEngine::
add_callback(const string &thread_name,
GraphicsEngine::CallbackTime callback_time,
GraphicsEngine::CallbackFunction *func, void *data) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
WindowRenderer *wr = get_window_renderer(thread_name, 0);
return wr->add_callback(callback_time, Callback(func, data));
}
@ -1015,7 +1015,7 @@ bool GraphicsEngine::
remove_callback(const string &thread_name,
GraphicsEngine::CallbackTime callback_time,
GraphicsEngine::CallbackFunction *func, void *data) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
WindowRenderer *wr = get_window_renderer(thread_name, 0);
return wr->remove_callback(callback_time, Callback(func, data));
}
@ -1092,7 +1092,7 @@ is_scene_root(const PandaNode *node) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::
set_window_sort(GraphicsOutput *window, int sort) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
window->_sort = sort;
_windows_sorted = false;
}
@ -1776,7 +1776,7 @@ do_draw(CullResult *cull_result, SceneSetup *scene_setup,
void GraphicsEngine::
do_add_window(GraphicsOutput *window,
const GraphicsThreadingModel &threading_model) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
// We have a special counter that is unique per window that allows
// us to assure that recently-added windows end up on the end of the
@ -1841,7 +1841,7 @@ do_add_window(GraphicsOutput *window,
void GraphicsEngine::
do_add_gsg(GraphicsStateGuardian *gsg, GraphicsPipe *pipe,
const GraphicsThreadingModel &threading_model) {
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
gsg->_threading_model = threading_model;
gsg->_pipe = pipe;
@ -2072,7 +2072,7 @@ auto_adjust_capabilities(GraphicsStateGuardian *gsg) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::
terminate_threads(Thread *current_thread) {
ReMutexHolder holder(_lock, current_thread);
LightReMutexHolder holder(_lock, current_thread);
// We spend almost our entire time in this method just waiting for
// threads. Time it appropriately.
@ -2221,7 +2221,7 @@ WindowRenderer(const string &name) :
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
add_gsg(GraphicsStateGuardian *gsg) {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
_gsgs.insert(gsg);
}
@ -2233,7 +2233,7 @@ add_gsg(GraphicsStateGuardian *gsg) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
add_window(Windows &wlist, GraphicsOutput *window) {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
wlist.insert(window);
}
@ -2247,7 +2247,7 @@ add_window(Windows &wlist, GraphicsOutput *window) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
remove_window(GraphicsOutput *window) {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
PT(GraphicsOutput) ptwin = window;
_cull.erase(ptwin);
@ -2284,7 +2284,7 @@ remove_window(GraphicsOutput *window) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
resort_windows() {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
_cull.sort();
_cdraw.sort();
@ -2324,7 +2324,7 @@ resort_windows() {
void GraphicsEngine::WindowRenderer::
do_frame(GraphicsEngine *engine, Thread *current_thread) {
PStatTimer timer(engine->_do_frame_pcollector, current_thread);
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
do_callbacks(CB_pre_frame);
@ -2367,7 +2367,7 @@ do_frame(GraphicsEngine *engine, Thread *current_thread) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
do_windows(GraphicsEngine *engine, Thread *current_thread) {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
engine->process_events(_window, current_thread);
@ -2383,7 +2383,7 @@ do_windows(GraphicsEngine *engine, Thread *current_thread) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
do_flip(GraphicsEngine *engine, Thread *current_thread) {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
engine->flip_windows(_cdraw, current_thread);
engine->flip_windows(_draw, current_thread);
}
@ -2395,7 +2395,7 @@ do_flip(GraphicsEngine *engine, Thread *current_thread) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
do_close(GraphicsEngine *engine, Thread *current_thread) {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
Windows::iterator wi;
for (wi = _window.begin(); wi != _window.end(); ++wi) {
GraphicsOutput *win = (*wi);
@ -2428,7 +2428,7 @@ do_close(GraphicsEngine *engine, Thread *current_thread) {
////////////////////////////////////////////////////////////////////
void GraphicsEngine::WindowRenderer::
do_pending(GraphicsEngine *engine, Thread *current_thread) {
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
if (!_pending_close.empty()) {
if (display_cat.is_debug()) {
@ -2477,7 +2477,7 @@ bool GraphicsEngine::WindowRenderer::
add_callback(GraphicsEngine::CallbackTime callback_time,
const GraphicsEngine::Callback &callback) {
nassertr(callback_time >= 0 && callback_time < CB_len, false);
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
return _callbacks[callback_time].insert(callback).second;
}
@ -2493,7 +2493,7 @@ bool GraphicsEngine::WindowRenderer::
remove_callback(GraphicsEngine::CallbackTime callback_time,
const GraphicsEngine::Callback &callback) {
nassertr(callback_time >= 0 && callback_time < CB_len, false);
ReMutexHolder holder(_wl_lock);
LightReMutexHolder holder(_wl_lock);
Callbacks::iterator cbi = _callbacks[callback_time].find(callback);
if (cbi != _callbacks[callback_time].end()) {
_callbacks[callback_time].erase(cbi);

View File

@ -24,7 +24,7 @@
#include "pointerTo.h"
#include "thread.h"
#include "pmutex.h"
#include "reMutex.h"
#include "lightReMutex.h"
#include "conditionVar.h"
#include "pStatCollector.h"
#include "pset.h"
@ -302,7 +302,7 @@ private:
GSGs _gsgs; // draw stage
Callbacks _callbacks[CB_len];
ReMutex _wl_lock;
LightReMutex _wl_lock;
};
class RenderThread : public Thread, public WindowRenderer {
@ -343,7 +343,7 @@ private:
bool _singular_warning_last_frame;
bool _singular_warning_this_frame;
ReMutex _lock;
LightReMutex _lock;
static PT(GraphicsEngine) _global_ptr;

View File

@ -17,7 +17,7 @@
#include "graphicsEngine.h"
#include "graphicsWindow.h"
#include "config_display.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "renderBuffer.h"
#include "indirectLess.h"
#include "pStatTimer.h"
@ -217,7 +217,7 @@ GraphicsOutput::
////////////////////////////////////////////////////////////////////
void GraphicsOutput::
clear_render_textures() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
throw_event("render-texture-targets-changed");
_textures.clear();
}
@ -268,7 +268,7 @@ add_render_texture(Texture *tex, RenderTextureMode mode,
if (mode == RTM_none) {
return;
}
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
throw_event("render-texture-targets-changed");
@ -442,7 +442,7 @@ set_sort(int sort) {
////////////////////////////////////////////////////////////////////
bool GraphicsOutput::
remove_display_region(DisplayRegion *display_region) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertr(display_region != _default_display_region, false);
@ -472,7 +472,7 @@ remove_display_region(DisplayRegion *display_region) {
////////////////////////////////////////////////////////////////////
void GraphicsOutput::
remove_all_display_regions() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
TotalDisplayRegions::iterator dri;
for (dri = _total_display_regions.begin();
@ -501,7 +501,7 @@ get_num_display_regions() const {
determine_display_regions();
int result;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
result = _total_display_regions.size();
}
return result;
@ -521,7 +521,7 @@ get_display_region(int n) const {
determine_display_regions();
PT(DisplayRegion) result;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (n >= 0 && n < (int)_total_display_regions.size()) {
result = _total_display_regions[n];
} else {
@ -542,7 +542,7 @@ get_num_active_display_regions() const {
determine_display_regions();
int result;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
result = _active_display_regions.size();
}
return result;
@ -562,7 +562,7 @@ get_active_display_region(int n) const {
determine_display_regions();
PT(DisplayRegion) result;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (n >= 0 && n < (int)_active_display_regions.size()) {
result = _active_display_regions[n];
} else {
@ -1200,7 +1200,7 @@ process_events() {
////////////////////////////////////////////////////////////////////
DisplayRegion *GraphicsOutput::
add_display_region(DisplayRegion *display_region) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_total_display_regions.push_back(display_region);
_display_regions_stale = true;
@ -1215,7 +1215,7 @@ add_display_region(DisplayRegion *display_region) {
////////////////////////////////////////////////////////////////////
void GraphicsOutput::
do_determine_display_regions() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_display_regions_stale = false;
_active_display_regions.clear();

View File

@ -27,7 +27,7 @@
#include "pandaNode.h"
#include "pStatCollector.h"
#include "pnotify.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "filename.h"
#include "drawMask.h"
#include "pvector.h"
@ -273,7 +273,7 @@ protected:
pvector<WPT(Texture)> _hold_textures;
protected:
Mutex _lock;
LightMutex _lock;
// protects _display_regions.
PT(DisplayRegion) _default_display_region;
typedef pvector< PT(DisplayRegion) > TotalDisplayRegions;

View File

@ -20,7 +20,7 @@
#include "graphicsDevice.h"
#include "typedReferenceCount.h"
#include "pointerTo.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "displayInformation.h"
class GraphicsOutput;
@ -121,7 +121,7 @@ protected:
int retry,
bool &precertify);
Mutex _lock;
LightMutex _lock;
bool _is_valid;
int _supported_types;

View File

@ -13,7 +13,7 @@
////////////////////////////////////////////////////////////////////
#include "graphicsPipeSelection.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "string_utils.h"
#include "filename.h"
#include "load_dso.h"
@ -95,7 +95,7 @@ get_num_pipe_types() const {
int result;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
result = _pipe_types.size();
}
return result;
@ -113,7 +113,7 @@ get_pipe_type(int n) const {
TypeHandle result;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (n >= 0 && n < (int)_pipe_types.size()) {
result = _pipe_types[n]._type;
}
@ -131,7 +131,7 @@ void GraphicsPipeSelection::
print_pipe_types() const {
load_default_module();
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nout << "Known pipe types:" << endl;
PipeTypes::const_iterator pi;
for (pi = _pipe_types.begin(); pi != _pipe_types.end(); ++pi) {
@ -202,7 +202,7 @@ make_pipe(const string &type_name, const string &module_name) {
////////////////////////////////////////////////////////////////////
PT(GraphicsPipe) GraphicsPipeSelection::
make_pipe(TypeHandle type) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
PipeTypes::const_iterator ti;
// First, look for an exact match of the requested type.
@ -257,7 +257,7 @@ PT(GraphicsPipe) GraphicsPipeSelection::
make_default_pipe() {
load_default_module();
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
PipeTypes::const_iterator ti;
if (!_default_pipe_name.empty()) {
@ -340,7 +340,7 @@ add_pipe_type(TypeHandle type, PipeConstructorFunc *func) {
// First, make sure we don't already have a GraphicsPipe of this
// type.
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
PipeTypes::const_iterator ti;
for (ti = _pipe_types.begin(); ti != _pipe_types.end(); ++ti) {
const PipeType &ptype = (*ti);

View File

@ -20,7 +20,7 @@
#include "graphicsPipe.h"
#include "pointerTo.h"
#include "typeHandle.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "vector_string.h"
class HardwareChannel;
@ -70,7 +70,7 @@ private:
};
typedef pvector<PipeType> PipeTypes;
PipeTypes _pipe_types;
Mutex _lock;
LightMutex _lock;
typedef vector_string DisplayModules;
DisplayModules _display_modules;

View File

@ -17,8 +17,8 @@
#include "config_display.h"
#include "mouseButton.h"
#include "keyboardButton.h"
#include "mutexHolder.h"
#include "reMutexHolder.h"
#include "lightMutexHolder.h"
#include "lightReMutexHolder.h"
#include "throw_event.h"
#include "string_utils.h"
@ -88,7 +88,7 @@ const WindowProperties GraphicsWindow::
get_properties() const {
WindowProperties result;
{
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
result = _properties;
}
return result;
@ -106,7 +106,7 @@ const WindowProperties GraphicsWindow::
get_requested_properties() const {
WindowProperties result;
{
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
result = _requested_properties;
}
return result;
@ -120,7 +120,7 @@ get_requested_properties() const {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
clear_rejected_properties() {
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
_rejected_properties.clear();
}
@ -137,7 +137,7 @@ WindowProperties GraphicsWindow::
get_rejected_properties() const {
WindowProperties result;
{
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
result = _rejected_properties;
}
return result;
@ -156,7 +156,7 @@ get_rejected_properties() const {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
request_properties(const WindowProperties &requested_properties) {
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
_requested_properties.add_properties(requested_properties);
if (!_has_size && _requested_properties.has_size()) {
@ -197,7 +197,7 @@ is_active() const {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
set_window_event(const string &window_event) {
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
_window_event = window_event;
}
@ -211,7 +211,7 @@ set_window_event(const string &window_event) {
string GraphicsWindow::
get_window_event() const {
string result;
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
result = _window_event;
return result;
}
@ -242,7 +242,7 @@ get_window_event() const {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
set_close_request_event(const string &close_request_event) {
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
_close_request_event = close_request_event;
}
@ -258,7 +258,7 @@ set_close_request_event(const string &close_request_event) {
string GraphicsWindow::
get_close_request_event() const {
string result;
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
result = _close_request_event;
return result;
}
@ -277,7 +277,7 @@ int GraphicsWindow::
get_num_input_devices() const {
int result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
result = _input_devices.size();
}
return result;
@ -292,7 +292,7 @@ string GraphicsWindow::
get_input_device_name(int device) const {
string result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), "");
result = _input_devices[device].get_name();
}
@ -310,7 +310,7 @@ bool GraphicsWindow::
has_pointer(int device) const {
bool result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), false);
result = _input_devices[device].has_pointer();
}
@ -327,7 +327,7 @@ bool GraphicsWindow::
has_keyboard(int device) const {
bool result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), false);
result = _input_devices[device].has_keyboard();
}
@ -341,7 +341,7 @@ has_keyboard(int device) const {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
enable_pointer_events(int device) {
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertv(device >= 0 && device < (int)_input_devices.size());
_input_devices[device].enable_pointer_events();
}
@ -353,7 +353,7 @@ enable_pointer_events(int device) {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
disable_pointer_events(int device) {
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertv(device >= 0 && device < (int)_input_devices.size());
_input_devices[device].disable_pointer_events();
}
@ -365,7 +365,7 @@ disable_pointer_events(int device) {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
enable_pointer_mode(int device, double speed) {
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertv(device >= 0 && device < (int)_input_devices.size());
_input_devices[device].enable_pointer_mode(speed);
}
@ -377,7 +377,7 @@ enable_pointer_mode(int device, double speed) {
////////////////////////////////////////////////////////////////////
void GraphicsWindow::
disable_pointer_mode(int device) {
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertv(device >= 0 && device < (int)_input_devices.size());
_input_devices[device].disable_pointer_mode();
}
@ -392,7 +392,7 @@ MouseData GraphicsWindow::
get_pointer(int device) const {
MouseData result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), MouseData());
result = _input_devices[device].get_pointer();
}
@ -438,7 +438,7 @@ bool GraphicsWindow::
has_button_event(int device) const {
bool result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), false);
result = _input_devices[device].has_button_event();
}
@ -455,7 +455,7 @@ ButtonEvent GraphicsWindow::
get_button_event(int device) {
ButtonEvent result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), ButtonEvent());
nassertr(_input_devices[device].has_button_event(), ButtonEvent());
result = _input_devices[device].get_button_event();
@ -475,7 +475,7 @@ bool GraphicsWindow::
has_pointer_event(int device) const {
bool result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), false);
result = _input_devices[device].has_pointer_event();
}
@ -492,7 +492,7 @@ PT(PointerEventList) GraphicsWindow::
get_pointer_events(int device) {
PT(PointerEventList) result;
{
MutexHolder holder(_input_lock);
LightMutexHolder holder(_input_lock);
nassertr(device >= 0 && device < (int)_input_devices.size(), NULL);
nassertr(_input_devices[device].has_pointer_event(), NULL);
result = _input_devices[device].get_pointer_events();
@ -591,7 +591,7 @@ process_events() {
// bitmask after all.
WindowProperties properties;
{
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
properties = _requested_properties;
_requested_properties.clear();
@ -806,7 +806,7 @@ system_changed_properties(const WindowProperties &properties) {
<< "system_changed_properties(" << properties << ")\n";
}
ReMutexHolder holder(_properties_lock);
LightReMutexHolder holder(_properties_lock);
if (properties.has_size()) {
system_changed_size(properties.get_x_size(), properties.get_y_size());

View File

@ -24,8 +24,8 @@
#include "modifierButtons.h"
#include "buttonEvent.h"
#include "pnotify.h"
#include "pmutex.h"
#include "reMutex.h"
#include "lightMutex.h"
#include "lightReMutex.h"
#include "pvector.h"
////////////////////////////////////////////////////////////////////
@ -121,13 +121,13 @@ protected:
INLINE void add_input_device(const GraphicsWindowInputDevice &device);
typedef vector_GraphicsWindowInputDevice InputDevices;
InputDevices _input_devices;
Mutex _input_lock;
LightMutex _input_lock;
protected:
WindowProperties _properties;
private:
ReMutex _properties_lock;
LightReMutex _properties_lock;
// protects _requested_properties, _rejected_properties, and
// _window_event.

View File

@ -19,7 +19,7 @@
////////////////////////////////////////////////////////////////////
INLINE GraphicsWindowInputDevice::
GraphicsWindowInputDevice() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_flags = 0;
}
@ -30,7 +30,7 @@ GraphicsWindowInputDevice() {
////////////////////////////////////////////////////////////////////
INLINE string GraphicsWindowInputDevice::
get_name() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _name;
}
@ -41,7 +41,7 @@ get_name() const {
////////////////////////////////////////////////////////////////////
INLINE bool GraphicsWindowInputDevice::
has_pointer() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return ((_flags & IDF_has_pointer) != 0);
}
@ -52,7 +52,7 @@ has_pointer() const {
////////////////////////////////////////////////////////////////////
INLINE bool GraphicsWindowInputDevice::
has_keyboard() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return ((_flags & IDF_has_keyboard) != 0);
}
@ -64,7 +64,7 @@ has_keyboard() const {
////////////////////////////////////////////////////////////////////
INLINE MouseData GraphicsWindowInputDevice::
get_pointer() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _mouse_data;
}
@ -77,7 +77,7 @@ get_pointer() const {
////////////////////////////////////////////////////////////////////
INLINE MouseData GraphicsWindowInputDevice::
get_raw_pointer() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _true_mouse_data;
}
@ -90,7 +90,7 @@ get_raw_pointer() const {
////////////////////////////////////////////////////////////////////
INLINE void GraphicsWindowInputDevice::
set_device_index(int index) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_device_index = index;
}
@ -101,7 +101,7 @@ set_device_index(int index) {
////////////////////////////////////////////////////////////////////
INLINE void GraphicsWindowInputDevice::
enable_pointer_events() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_enable_pointer_events = true;
}
@ -112,7 +112,7 @@ enable_pointer_events() {
////////////////////////////////////////////////////////////////////
INLINE void GraphicsWindowInputDevice::
disable_pointer_events() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_enable_pointer_events = false;
_pointer_events.clear();
}

View File

@ -108,8 +108,8 @@ GraphicsWindowInputDevice(const GraphicsWindowInputDevice &copy)
void GraphicsWindowInputDevice::
operator = (const GraphicsWindowInputDevice &copy)
{
MutexHolder holder(_lock);
MutexHolder holder1(copy._lock);
LightMutexHolder holder(_lock);
LightMutexHolder holder1(copy._lock);
_host = copy._host;
_name = copy._name;
_flags = copy._flags;
@ -146,7 +146,7 @@ GraphicsWindowInputDevice::
////////////////////////////////////////////////////////////////////
bool GraphicsWindowInputDevice::
has_button_event() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return !_button_events.empty();
}
@ -158,7 +158,7 @@ has_button_event() const {
////////////////////////////////////////////////////////////////////
ButtonEvent GraphicsWindowInputDevice::
get_button_event() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
ButtonEvent be = _button_events.front();
_button_events.pop_front();
return be;
@ -174,7 +174,7 @@ get_button_event() {
////////////////////////////////////////////////////////////////////
bool GraphicsWindowInputDevice::
has_pointer_event() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return (_pointer_events != 0);
}
@ -186,7 +186,7 @@ has_pointer_event() const {
////////////////////////////////////////////////////////////////////
PT(PointerEventList) GraphicsWindowInputDevice::
get_pointer_events() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
PT(PointerEventList) result = _pointer_events;
_pointer_events = 0;
return result;
@ -212,7 +212,7 @@ get_pointer_events() {
////////////////////////////////////////////////////////////////////
void GraphicsWindowInputDevice::
enable_pointer_mode(double speed) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertv(_device_index != 0);
_pointer_mode_enable = true;
_pointer_speed = speed;
@ -230,7 +230,7 @@ enable_pointer_mode(double speed) {
////////////////////////////////////////////////////////////////////
void GraphicsWindowInputDevice::
disable_pointer_mode() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertv(_device_index != 0);
_pointer_mode_enable = false;
_pointer_speed = 1.0;
@ -246,7 +246,7 @@ disable_pointer_mode() {
////////////////////////////////////////////////////////////////////
void GraphicsWindowInputDevice::
set_pointer(bool inwin, int x, int y, double time) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
int delta_x = x - _true_mouse_data._xpos;
int delta_y = y - _true_mouse_data._ypos;
@ -289,7 +289,7 @@ set_pointer(bool inwin, int x, int y, double time) {
////////////////////////////////////////////////////////////////////
void GraphicsWindowInputDevice::
button_down(ButtonHandle button, double time) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_button_events.push_back(ButtonEvent(button, ButtonEvent::T_down, time));
}
@ -303,7 +303,7 @@ button_down(ButtonHandle button, double time) {
////////////////////////////////////////////////////////////////////
void GraphicsWindowInputDevice::
button_resume_down(ButtonHandle button, double time) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_button_events.push_back(ButtonEvent(button, ButtonEvent::T_resume_down, time));
}
@ -314,7 +314,7 @@ button_resume_down(ButtonHandle button, double time) {
////////////////////////////////////////////////////////////////////
void GraphicsWindowInputDevice::
button_up(ButtonHandle button, double time) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_button_events.push_back(ButtonEvent(button, ButtonEvent::T_up, time));
}
@ -326,7 +326,7 @@ button_up(ButtonHandle button, double time) {
////////////////////////////////////////////////////////////////////
void GraphicsWindowInputDevice::
keystroke(int keycode, double time) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_button_events.push_back(ButtonEvent(keycode, time));
}
@ -339,7 +339,7 @@ keystroke(int keycode, double time) {
void GraphicsWindowInputDevice::
candidate(const wstring &candidate_string, size_t highlight_start,
size_t highlight_end, size_t cursor_pos) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_button_events.push_back(ButtonEvent(candidate_string,
highlight_start, highlight_end,
cursor_pos));

View File

@ -25,8 +25,8 @@
#include "pdeque.h"
#include "pvector.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
////////////////////////////////////////////////////////////////////
@ -100,7 +100,7 @@ private:
};
typedef pdeque<ButtonEvent> ButtonEvents;
Mutex _lock;
LightMutex _lock;
GraphicsWindow *_host;

View File

@ -18,8 +18,8 @@
#define ENABLE_MUTEX 1
#if ENABLE_MUTEX
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
#define LruMutexHolder(mutex) MutexHolder(mutex)
#else
#define LruMutexHolder(mutex)

View File

@ -24,7 +24,7 @@
#include "string_utils.h"
#include "dSearchPath.h"
#include "virtualFileSystem.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "zStream.h"
extern int eggyyparse();
@ -122,7 +122,7 @@ read(istream &in) {
int error_count;
{
MutexHolder holder(egg_lock);
LightMutexHolder holder(egg_lock);
egg_init_parser(in, get_egg_filename(), data, data);
eggyyparse();
egg_cleanup_parser();

View File

@ -254,7 +254,7 @@ parse_egg(const string &egg_syntax) {
istringstream in(egg_syntax);
MutexHolder holder(egg_lock);
LightMutexHolder holder(egg_lock);
egg_init_parser(in, "", this, group);

View File

@ -745,7 +745,7 @@ char *yytext;
#include "parser.h"
#include "indent.h"
#include "pnotify.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "thread.h"
#include <math.h>
@ -760,7 +760,7 @@ static int yyinput(void); // declared by flex.
////////////////////////////////////////////////////////////////////
// This mutex protects all of these global variables.
Mutex egg_lock;
LightMutex egg_lock;
// We'll increment line_number and col_number as we parse the file, so
// that we can report the position of an error.

View File

@ -13,7 +13,7 @@
#include "parser.h"
#include "indent.h"
#include "pnotify.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "thread.h"
#include <math.h>
@ -28,7 +28,7 @@ static int yyinput(void); // declared by flex.
////////////////////////////////////////////////////////////////////
// This mutex protects all of these global variables.
Mutex egg_lock;
LightMutex egg_lock;
// We'll increment line_number and col_number as we parse the file, so
// that we can report the position of an error.

View File

@ -26,9 +26,9 @@
#include <string>
class EggGroupNode;
class Mutex;
class LightMutex;
extern Mutex egg_lock;
extern LightMutex egg_lock;
void egg_init_parser(istream &in, const string &filename,
EggObject *tos, EggGroupNode *egg_top_node);

View File

@ -21,7 +21,6 @@
#include "asyncTaskCollection.h"
#include "typedReferenceCount.h"
#include "thread.h"
#include "pmutex.h"
#include "conditionVarFull.h"
#include "pvector.h"
#include "pdeque.h"

View File

@ -23,6 +23,7 @@
#include "typedReferenceCount.h"
#include "thread.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "conditionVarFull.h"
#include "pvector.h"
#include "pdeque.h"

View File

@ -14,7 +14,7 @@
#include "eventQueue.h"
#include "config_event.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
EventQueue *EventQueue::_global_event_queue = NULL;
@ -50,7 +50,7 @@ queue_event(CPT_Event event) {
return;
}
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_queue.push_back(event);
if (event_cat.is_spam() || event_cat.is_debug()) {
@ -73,7 +73,7 @@ queue_event(CPT_Event event) {
////////////////////////////////////////////////////////////////////
void EventQueue::
clear() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_queue.clear();
}
@ -86,7 +86,7 @@ clear() {
////////////////////////////////////////////////////////////////////
bool EventQueue::
is_queue_empty() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _queue.empty();
}
@ -109,7 +109,7 @@ is_queue_full() const {
////////////////////////////////////////////////////////////////////
CPT_Event EventQueue::
dequeue_event() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
CPT_Event result = _queue.front();
_queue.pop_front();

View File

@ -19,7 +19,7 @@
#include "event.h"
#include "pt_Event.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pdeque.h"
////////////////////////////////////////////////////////////////////
@ -50,7 +50,7 @@ private:
typedef pdeque<CPT_Event> Events;
Events _queue;
Mutex _lock;
LightMutex _lock;
};
#include "eventQueue.I"

View File

@ -42,7 +42,7 @@
#include "string_utils.h"
#include "pnmImage.h"
#include "config_gobj.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "indirectLess.h"
#include "pStatTimer.h"
#include "load_prc_file.h"
@ -1670,7 +1670,7 @@ end_frame(Thread *current_thread) {
// Now is a good time to delete any pending display lists.
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (!_deleted_display_lists.empty()) {
DeletedDisplayLists::iterator ddli;
for (ddli = _deleted_display_lists.begin();
@ -2795,7 +2795,7 @@ release_shader(ShaderContext *sc) {
////////////////////////////////////////////////////////////////////
void CLP(GraphicsStateGuardian)::
record_deleted_display_list(GLuint index) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_deleted_display_lists.push_back(index);
}

View File

@ -33,7 +33,7 @@
#include "pset.h"
#include "pmap.h"
#include "geomVertexArrayData.h"
#include "pmutex.h"
#include "lightMutex.h"
class PlaneNode;
class Light;
@ -503,7 +503,7 @@ public:
GLenum _mirror_edge_clamp;
GLenum _mirror_border_clamp;
Mutex _lock;
LightMutex _lock;
typedef pvector<GLuint> DeletedDisplayLists;
DeletedDisplayLists _deleted_display_lists;
DeletedDisplayLists _deleted_queries;

View File

@ -14,7 +14,7 @@
#include "pnotify.h"
#include "dcast.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "pStatTimer.h"
TypeHandle CLP(OcclusionQueryContext)::_type_handle;
@ -30,7 +30,7 @@ CLP(OcclusionQueryContext)::
// Tell the GSG to recycle this index when it gets around to it.
CLP(GraphicsStateGuardian) *glgsg;
DCAST_INTO_V(glgsg, _gsg);
MutexHolder holder(glgsg->_lock);
LightMutexHolder holder(glgsg->_lock);
glgsg->_deleted_queries.push_back(_index);
_index = 0;

View File

@ -19,8 +19,8 @@
#include "graphicsWindow.h"
#include "graphicsPipe.h"
#include "glgsg.h"
#include "pmutex.h"
#include "reMutex.h"
#include "lightMutex.h"
#include "lightReMutex.h"
class FrameBufferProperties;
@ -151,7 +151,7 @@ private:
public:
// This Mutex protects any X library calls, which all have to be
// single-threaded. In particular, it protects glXMakeCurrent().
static ReMutex _x_mutex;
static LightReMutex _x_mutex;
public:
static TypeHandle get_class_type() {

View File

@ -15,7 +15,7 @@
#include "glxGraphicsStateGuardian.h"
#include "config_glxdisplay.h"
#include "config_glgsg.h"
#include "reMutexHolder.h"
#include "lightReMutexHolder.h"
#include <dlfcn.h>
@ -388,7 +388,7 @@ glx_is_at_least_version(int major_version, int minor_version) const {
void glxGraphicsStateGuardian::
gl_flush() const {
// This call requires synchronization with X.
ReMutexHolder holder(glxGraphicsPipe::_x_mutex);
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
GLGraphicsStateGuardian::gl_flush();
}
@ -400,7 +400,7 @@ gl_flush() const {
GLenum glxGraphicsStateGuardian::
gl_get_error() const {
// This call requires synchronization with X.
ReMutexHolder holder(glxGraphicsPipe::_x_mutex);
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
return GLGraphicsStateGuardian::gl_get_error();
}

View File

@ -25,7 +25,7 @@
#include "pStatTimer.h"
#include "textEncoder.h"
#include "throw_event.h"
#include "reMutexHolder.h"
#include "lightReMutexHolder.h"
#include <errno.h>
#include <sys/time.h>
@ -151,7 +151,7 @@ begin_frame(FrameMode mode, Thread *current_thread) {
glxGraphicsStateGuardian *glxgsg;
DCAST_INTO_R(glxgsg, _gsg, false);
{
ReMutexHolder holder(glxGraphicsPipe::_x_mutex);
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
if (glXGetCurrentDisplay() == _display &&
glXGetCurrentDrawable() == _xwindow &&
@ -231,7 +231,7 @@ begin_flip() {
//make_current();
ReMutexHolder holder(glxGraphicsPipe::_x_mutex);
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
glXSwapBuffers(_display, _xwindow);
}
}
@ -248,7 +248,7 @@ begin_flip() {
////////////////////////////////////////////////////////////////////
void glxGraphicsWindow::
process_events() {
ReMutexHolder holder(glxGraphicsPipe::_x_mutex);
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
GraphicsWindow::process_events();

View File

@ -21,7 +21,7 @@
////////////////////////////////////////////////////////////////////
INLINE size_t AdaptiveLru::
get_total_size() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _total_size;
}
@ -33,7 +33,7 @@ get_total_size() const {
////////////////////////////////////////////////////////////////////
INLINE size_t AdaptiveLru::
get_max_size() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _max_size;
}
@ -47,7 +47,7 @@ get_max_size() const {
////////////////////////////////////////////////////////////////////
INLINE void AdaptiveLru::
set_max_size(size_t max_size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_max_size = max_size;
if (_total_size > _max_size) {
do_evict_to(_max_size, false);
@ -61,7 +61,7 @@ set_max_size(size_t max_size) {
////////////////////////////////////////////////////////////////////
INLINE void AdaptiveLru::
consider_evict() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_total_size > _max_size) {
do_evict_to(_max_size, false);
}
@ -76,7 +76,7 @@ consider_evict() {
////////////////////////////////////////////////////////////////////
INLINE void AdaptiveLru::
evict_to(size_t target_size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_total_size > target_size) {
do_evict_to(target_size, true);
}
@ -91,7 +91,7 @@ evict_to(size_t target_size) {
////////////////////////////////////////////////////////////////////
INLINE bool AdaptiveLru::
validate() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_validate();
}
@ -219,7 +219,7 @@ get_lru_size() const {
INLINE void AdaptiveLruPage::
set_lru_size(size_t lru_size) {
if (_lru != (AdaptiveLru *)NULL) {
MutexHolder holder(_lru->_lock);
LightMutexHolder holder(_lru->_lock);
_lru->_total_size -= _lru_size;
_lru->_total_size += lru_size;
_lru_size = lru_size;

View File

@ -234,7 +234,7 @@ count_active_size() const {
////////////////////////////////////////////////////////////////////
void AdaptiveLru::
begin_epoch() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
do_partial_lru_update(_max_updates_per_frame);
if (_total_size > _max_size) {
do_evict_to(_max_size, false);
@ -250,7 +250,7 @@ begin_epoch() {
////////////////////////////////////////////////////////////////////
void AdaptiveLru::
output(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
out << "AdaptiveLru " << get_name()
<< ", " << _total_size << " of " << _max_size;
}
@ -268,7 +268,7 @@ write(ostream &out, int indent_level) const {
// the freshest in the LRU. Things at the end of the list will be
// the next to be evicted.
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
int index;
for (index = 0; index < LPP_TotalPriorities; ++index) {
@ -302,7 +302,7 @@ write(ostream &out, int indent_level) const {
void AdaptiveLru::
do_add_page(AdaptiveLruPage *page) {
nassertv(page != (AdaptiveLruPage *)NULL && page->_lru == this);
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_total_size += page->_lru_size;
((AdaptiveLruPageDynamicList *)page)->insert_before(&_page_array[page->_priority]);
@ -317,7 +317,7 @@ do_add_page(AdaptiveLruPage *page) {
void AdaptiveLru::
do_remove_page(AdaptiveLruPage *page) {
nassertv(page != (AdaptiveLruPage *)NULL && page->_lru == this);
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_total_size -= page->_lru_size;
((AdaptiveLruPageDynamicList *)page)->remove_from_list();
@ -332,7 +332,7 @@ do_remove_page(AdaptiveLruPage *page) {
void AdaptiveLru::
do_access_page(AdaptiveLruPage *page) {
nassertv(page != (AdaptiveLruPage *)NULL && page->_lru == this);
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (page->_current_frame_identifier == _current_frame_identifier) {
// This is the second or more time this page is accessed this

View File

@ -18,8 +18,8 @@
#include "pandabase.h"
#include "linkedListNode.h"
#include "namable.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
class AdaptiveLruPage;
@ -99,7 +99,7 @@ private:
void do_evict_to(size_t target_size, bool hard_evict);
bool do_validate();
Mutex _lock;
LightMutex _lock;
size_t _total_size;
size_t _max_size;

View File

@ -23,7 +23,7 @@
#include "bamWriter.h"
#include "boundingSphere.h"
#include "boundingBox.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "config_mathutil.h"
UpdateSeq Geom::_next_modified;
@ -1005,7 +1005,7 @@ write(ostream &out, int indent_level) const {
////////////////////////////////////////////////////////////////////
void Geom::
clear_cache() {
MutexHolder holder(_cache_lock);
LightMutexHolder holder(_cache_lock);
for (Cache::iterator ci = _cache.begin();
ci != _cache.end();
++ci) {
@ -1028,7 +1028,7 @@ clear_cache() {
////////////////////////////////////////////////////////////////////
void Geom::
clear_cache_stage(Thread *current_thread) {
MutexHolder holder(_cache_lock);
LightMutexHolder holder(_cache_lock);
for (Cache::iterator ci = _cache.begin();
ci != _cache.end();
++ci) {
@ -1558,7 +1558,7 @@ make_copy() const {
////////////////////////////////////////////////////////////////////
void Geom::CacheEntry::
evict_callback() {
MutexHolder holder(_source->_cache_lock);
LightMutexHolder holder(_source->_cache_lock);
Cache::iterator ci = _source->_cache.find(&_key);
nassertv(ci != _source->_cache.end());
nassertv((*ci).second == this);

View File

@ -39,7 +39,7 @@
#include "boundingVolume.h"
#include "pStatCollector.h"
#include "deletedChain.h"
#include "pmutex.h"
#include "lightMutex.h"
class GeomContext;
class PreparedGraphicsObjects;
@ -321,7 +321,7 @@ private:
typedef CycleDataStageWriter<CData> CDStageWriter;
Cache _cache;
Mutex _cache_lock;
LightMutex _cache_lock;
// This works just like the Texture contexts: each Geom keeps a
// record of all the PGO objects that hold the Geom, and vice-versa.

View File

@ -14,7 +14,7 @@
#include "geomCacheEntry.h"
#include "geomCacheManager.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "config_gobj.h"
#include "clockObject.h"
@ -39,7 +39,7 @@ record(Thread *current_thread) {
PT(GeomCacheEntry) keepme = this;
GeomCacheManager *cache_mgr = GeomCacheManager::get_global_ptr();
MutexHolder holder(cache_mgr->_lock);
LightMutexHolder holder(cache_mgr->_lock);
if (gobj_cat.is_debug()) {
gobj_cat.debug()
@ -79,7 +79,7 @@ record(Thread *current_thread) {
void GeomCacheEntry::
refresh(Thread *current_thread) {
GeomCacheManager *cache_mgr = GeomCacheManager::get_global_ptr();
MutexHolder holder(cache_mgr->_lock);
LightMutexHolder holder(cache_mgr->_lock);
nassertv(_next != (GeomCacheEntry *)NULL && _prev != (GeomCacheEntry *)NULL);
remove_from_list();
@ -114,7 +114,7 @@ erase() {
}
GeomCacheManager *cache_mgr = GeomCacheManager::get_global_ptr();
MutexHolder holder(cache_mgr->_lock);
LightMutexHolder holder(cache_mgr->_lock);
remove_from_list();
--cache_mgr->_total_size;

View File

@ -14,7 +14,7 @@
#include "geomCacheManager.h"
#include "geomCacheEntry.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
GeomCacheManager *GeomCacheManager::_global_ptr = NULL;
@ -59,7 +59,7 @@ GeomCacheManager::
////////////////////////////////////////////////////////////////////
void GeomCacheManager::
flush() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
evict_old_entries(0, false);
}

View File

@ -17,7 +17,7 @@
#include "pandabase.h"
#include "config_gobj.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pStatCollector.h"
class GeomCacheEntry;
@ -63,7 +63,7 @@ public:
private:
// This mutex protects all operations on this object, especially the
// linked-list operations.
Mutex _lock;
LightMutex _lock;
int _total_size;

View File

@ -15,8 +15,8 @@
#include "geomMunger.h"
#include "geom.h"
#include "geomCacheManager.h"
#include "mutexHolder.h"
#include "reMutexHolder.h"
#include "lightMutexHolder.h"
#include "lightReMutexHolder.h"
#include "pStatTimer.h"
GeomMunger::Registry *GeomMunger::_registry = NULL;
@ -36,7 +36,7 @@ GeomMunger(GraphicsStateGuardianBase *gsg) :
{
#ifndef NDEBUG
Registry *registry = get_registry();
ReMutexHolder holder(registry->_registry_lock);
LightReMutexHolder holder(registry->_registry_lock);
_registered_key = registry->_mungers.end();
#endif
}
@ -52,7 +52,7 @@ GeomMunger(const GeomMunger &copy) :
{
#ifndef NDEBUG
Registry *registry = get_registry();
ReMutexHolder holder(registry->_registry_lock);
LightReMutexHolder holder(registry->_registry_lock);
_registered_key = registry->_mungers.end();
#endif
}
@ -168,7 +168,7 @@ munge_geom(CPT(Geom) &geom, CPT(GeomVertexData) &data,
// Create a new entry for the result.
entry = new Geom::CacheEntry(orig_geom, source_data, this);
{
MutexHolder holder(orig_geom->_cache_lock);
LightMutexHolder holder(orig_geom->_cache_lock);
bool inserted = orig_geom->_cache.insert(Geom::Cache::value_type(&entry->_key, entry)).second;
if (!inserted) {
// Some other thread must have beat us to the punch. Never
@ -203,7 +203,7 @@ do_munge_format(const GeomVertexFormat *format,
nassertr(_is_registered, NULL);
nassertr(format->is_registered(), NULL);
MutexHolder holder(_formats_lock);
LightMutexHolder holder(_formats_lock);
Formats &formats = _formats_by_animation[animation];
@ -281,7 +281,7 @@ do_premunge_format(const GeomVertexFormat *format) {
nassertr(_is_registered, NULL);
nassertr(format->is_registered(), NULL);
MutexHolder holder(_formats_lock);
LightMutexHolder holder(_formats_lock);
Formats::iterator fi;
fi = _premunge_formats.find(format);
@ -472,7 +472,7 @@ register_munger(GeomMunger *munger, Thread *current_thread) {
// will be automatically deleted when this function returns.
PT(GeomMunger) pt_munger = munger;
ReMutexHolder holder(_registry_lock);
LightReMutexHolder holder(_registry_lock);
Mungers::iterator mi = _mungers.insert(munger).first;
GeomMunger *new_munger = (*mi);
@ -493,7 +493,7 @@ register_munger(GeomMunger *munger, Thread *current_thread) {
////////////////////////////////////////////////////////////////////
void GeomMunger::Registry::
unregister_munger(GeomMunger *munger) {
ReMutexHolder holder(_registry_lock);
LightReMutexHolder holder(_registry_lock);
nassertv(munger->is_registered());
nassertv(munger->_registered_key != _mungers.end());
@ -510,7 +510,7 @@ unregister_munger(GeomMunger *munger) {
////////////////////////////////////////////////////////////////////
void GeomMunger::Registry::
unregister_mungers_for_gsg(GraphicsStateGuardianBase *gsg) {
ReMutexHolder holder(_registry_lock);
LightReMutexHolder holder(_registry_lock);
Mungers::iterator mi = _mungers.begin();
while (mi != _mungers.end()) {

View File

@ -23,8 +23,8 @@
#include "geomCacheEntry.h"
#include "indirectCompareTo.h"
#include "pStatCollector.h"
#include "pmutex.h"
#include "reMutex.h"
#include "lightMutex.h"
#include "lightReMutex.h"
#include "pointerTo.h"
#include "pmap.h"
#include "pset.h"
@ -127,7 +127,7 @@ private:
Formats _premunge_formats;
// This mutex protects the above.
Mutex _formats_lock;
LightMutex _formats_lock;
GraphicsStateGuardianBase *_gsg;
@ -141,7 +141,7 @@ private:
void unregister_mungers_for_gsg(GraphicsStateGuardianBase *gsg);
Mungers _mungers;
ReMutex _registry_lock;
LightReMutex _registry_lock;
};
// We store the iterator into the above registry, while we are

View File

@ -28,7 +28,7 @@
#include "cycleDataStageWriter.h"
#include "pipelineCycler.h"
#include "pmap.h"
#include "reMutex.h"
#include "lightReMutex.h"
#include "simpleLru.h"
#include "vertexDataBuffer.h"
#include "config_gobj.h"
@ -166,7 +166,7 @@ private:
// This implements read-write locking. Anyone who gets the data for
// reading or writing will hold this mutex during the lock.
ReMutex _rw_lock;
LightReMutex _rw_lock;
public:
static TypeHandle get_class_type() {

View File

@ -20,7 +20,7 @@
#include "bamReader.h"
#include "bamWriter.h"
#include "indirectLess.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
GeomVertexArrayFormat::Registry *GeomVertexArrayFormat::_registry = NULL;
TypeHandle GeomVertexArrayFormat::_type_handle;
@ -202,7 +202,7 @@ GeomVertexArrayFormat::
bool GeomVertexArrayFormat::
unref() const {
Registry *registry = get_registry();
MutexHolder holder(registry->_lock);
LightMutexHolder holder(registry->_lock);
if (ReferenceCount::unref()) {
return true;
@ -782,7 +782,7 @@ register_format(GeomVertexArrayFormat *format) {
GeomVertexArrayFormat *new_format;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
ArrayFormats::iterator fi = _formats.insert(format).first;
new_format = (*fi);
if (!new_format->is_registered()) {

View File

@ -22,7 +22,7 @@
#include "indirectCompareTo.h"
#include "pvector.h"
#include "pmap.h"
#include "pmutex.h"
#include "lightMutex.h"
class GeomVertexFormat;
class GeomVertexData;
@ -146,7 +146,7 @@ private:
void unregister_format(GeomVertexArrayFormat *format);
ArrayFormats _formats;
Mutex _lock;
LightMutex _lock;
};
static Registry *_registry;

View File

@ -800,7 +800,7 @@ convert_to(const GeomVertexFormat *new_format) const {
// Create a new entry for the result.
entry = new CacheEntry((GeomVertexData *)this, new_format);
{
MutexHolder holder(_cache_lock);
LightMutexHolder holder(_cache_lock);
bool inserted = ((GeomVertexData *)this)->_cache.insert(Cache::value_type(&entry->_key, entry)).second;
if (!inserted) {
// Some other thread must have beat us to the punch. Never
@ -1230,7 +1230,7 @@ write(ostream &out, int indent_level) const {
////////////////////////////////////////////////////////////////////
void GeomVertexData::
clear_cache() {
MutexHolder holder(_cache_lock);
LightMutexHolder holder(_cache_lock);
for (Cache::iterator ci = _cache.begin();
ci != _cache.end();
++ci) {
@ -1253,7 +1253,7 @@ clear_cache() {
////////////////////////////////////////////////////////////////////
void GeomVertexData::
clear_cache_stage() {
MutexHolder holder(_cache_lock);
LightMutexHolder holder(_cache_lock);
for (Cache::iterator ci = _cache.begin();
ci != _cache.end();
++ci) {
@ -1793,7 +1793,7 @@ make_copy() const {
////////////////////////////////////////////////////////////////////
void GeomVertexData::CacheEntry::
evict_callback() {
MutexHolder holder(_source->_cache_lock);
LightMutexHolder holder(_source->_cache_lock);
Cache::iterator ci = _source->_cache.find(&_key);
nassertv(ci != _source->_cache.end());
nassertv((*ci).second == this);

View File

@ -305,7 +305,7 @@ private:
typedef CycleDataStageWriter<CData> CDStageWriter;
Cache _cache;
Mutex _cache_lock;
LightMutex _cache_lock;
private:
void update_animated_vertices(CData *cdata, Thread *current_thread);

View File

@ -15,7 +15,7 @@
#include "geomVertexFormat.h"
#include "geomVertexData.h"
#include "geomMunger.h"
#include "reMutexHolder.h"
#include "lightReMutexHolder.h"
#include "indent.h"
#include "bamReader.h"
#include "bamWriter.h"
@ -96,7 +96,7 @@ GeomVertexFormat::
bool GeomVertexFormat::
unref() const {
Registry *registry = get_registry();
ReMutexHolder holder(registry->_lock);
LightReMutexHolder holder(registry->_lock);
if (ReferenceCount::unref()) {
return true;
@ -1058,7 +1058,7 @@ register_format(GeomVertexFormat *format) {
GeomVertexFormat *new_format;
{
ReMutexHolder holder(_lock);
LightReMutexHolder holder(_lock);
Formats::iterator fi = _formats.insert(format).first;
new_format = (*fi);
if (!new_format->is_registered()) {

View File

@ -27,7 +27,7 @@
#include "pset.h"
#include "pvector.h"
#include "indirectCompareTo.h"
#include "reMutex.h"
#include "lightReMutex.h"
class FactoryParams;
class GeomVertexData;
@ -218,7 +218,7 @@ private:
void unregister_format(GeomVertexFormat *format);
Formats _formats;
ReMutex _lock;
LightReMutex _lock;
CPT(GeomVertexFormat) _v3;
CPT(GeomVertexFormat) _v3n3;

View File

@ -65,7 +65,7 @@ InternalName::
#ifndef NDEBUG
if (_parent != (const InternalName *)NULL) {
// unref() should have removed us from our parent's table already.
MutexHolder holder(_parent->_name_table_lock);
LightMutexHolder holder(_parent->_name_table_lock);
NameTable::iterator ni = _parent->_name_table.find(_basename);
nassertv(ni == _parent->_name_table.end());
}
@ -88,7 +88,7 @@ unref() const {
return TypedWritableReferenceCount::unref();
}
MutexHolder holder(_parent->_name_table_lock);
LightMutexHolder holder(_parent->_name_table_lock);
if (ReferenceCount::unref()) {
return true;
@ -123,7 +123,7 @@ append(const string &name) {
return append(name.substr(0, dot))->append(name.substr(dot + 1));
}
MutexHolder holder(_name_table_lock);
LightMutexHolder holder(_name_table_lock);
NameTable::iterator ni = _name_table.find(name);
if (ni != _name_table.end()) {

View File

@ -20,7 +20,7 @@
#include "typedWritableReferenceCount.h"
#include "pointerTo.h"
#include "pmap.h"
#include "pmutex.h"
#include "lightMutex.h"
class FactoryParams;
@ -93,7 +93,7 @@ private:
typedef phash_map<string, InternalName *, string_hash> NameTable;
NameTable _name_table;
Mutex _name_table_lock;
LightMutex _name_table_lock;
static PT(InternalName) _root;
static PT(InternalName) _error;

View File

@ -14,7 +14,7 @@
#include "materialPool.h"
#include "config_gobj.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
MaterialPool *MaterialPool::_global_ptr = (MaterialPool *)NULL;
@ -37,7 +37,7 @@ write(ostream &out) {
////////////////////////////////////////////////////////////////////
Material *MaterialPool::
ns_get_material(Material *temp) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
CPT(Material) cpttemp = temp;
Materials::iterator mi = _materials.find(cpttemp);
@ -60,7 +60,7 @@ ns_get_material(Material *temp) {
////////////////////////////////////////////////////////////////////
int MaterialPool::
ns_garbage_collect() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
int num_released = 0;
Materials new_set;
@ -91,7 +91,7 @@ ns_garbage_collect() {
////////////////////////////////////////////////////////////////////
void MaterialPool::
ns_list_contents(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
out << _materials.size() << " materials:\n";
Materials::const_iterator mi;

View File

@ -18,7 +18,7 @@
#include "pandabase.h"
#include "material.h"
#include "pointerTo.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pset.h"
////////////////////////////////////////////////////////////////////
@ -57,7 +57,7 @@ private:
static MaterialPool *_global_ptr;
Mutex _lock;
LightMutex _lock;
// We store a map of CPT(Material) to PT(Material). These are two
// equivalent structures, but different pointers. The first pointer

View File

@ -19,7 +19,7 @@
// Description:
////////////////////////////////////////////////////////////////////
INLINE SimpleAllocator::
SimpleAllocator(size_t max_size, Mutex &lock) :
SimpleAllocator(size_t max_size, LightMutex &lock) :
LinkedListNode(true),
_total_size(0),
_max_size(max_size),
@ -39,7 +39,7 @@ SimpleAllocator(size_t max_size, Mutex &lock) :
////////////////////////////////////////////////////////////////////
SimpleAllocatorBlock *SimpleAllocator::
alloc(size_t size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_alloc(size);
}
@ -51,7 +51,7 @@ alloc(size_t size) {
////////////////////////////////////////////////////////////////////
INLINE bool SimpleAllocator::
is_empty() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_is_empty();
}
@ -62,7 +62,7 @@ is_empty() const {
////////////////////////////////////////////////////////////////////
INLINE size_t SimpleAllocator::
get_total_size() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _total_size;
}
@ -73,7 +73,7 @@ get_total_size() const {
////////////////////////////////////////////////////////////////////
INLINE size_t SimpleAllocator::
get_max_size() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _max_size;
}
@ -86,7 +86,7 @@ get_max_size() const {
////////////////////////////////////////////////////////////////////
INLINE void SimpleAllocator::
set_max_size(size_t max_size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_max_size = max_size;
}
@ -102,7 +102,7 @@ set_max_size(size_t max_size) {
////////////////////////////////////////////////////////////////////
INLINE size_t SimpleAllocator::
get_contiguous() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _contiguous;
}
@ -114,7 +114,7 @@ get_contiguous() const {
////////////////////////////////////////////////////////////////////
INLINE SimpleAllocatorBlock *SimpleAllocator::
get_first_block() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return (_next == this) ? (SimpleAllocatorBlock *)NULL : (SimpleAllocatorBlock *)_next;
}
@ -194,7 +194,7 @@ INLINE SimpleAllocatorBlock::
INLINE void SimpleAllocatorBlock::
free() {
if (_allocator != (SimpleAllocator *)NULL) {
MutexHolder holder(_allocator->_lock);
LightMutexHolder holder(_allocator->_lock);
do_free();
}
}
@ -254,7 +254,7 @@ is_free() const {
INLINE size_t SimpleAllocatorBlock::
get_max_size() const {
nassertr(_allocator != (SimpleAllocator *)NULL, 0);
MutexHolder holder(_allocator->_lock);
LightMutexHolder holder(_allocator->_lock);
return do_get_max_size();
}
@ -268,7 +268,7 @@ get_max_size() const {
INLINE bool SimpleAllocatorBlock::
realloc(size_t size) {
nassertr(_allocator != (SimpleAllocator *)NULL, false);
MutexHolder holder(_allocator->_lock);
LightMutexHolder holder(_allocator->_lock);
return do_realloc(size);
}
@ -281,7 +281,7 @@ realloc(size_t size) {
INLINE SimpleAllocatorBlock *SimpleAllocatorBlock::
get_next_block() const {
nassertr(_allocator != (SimpleAllocator *)NULL, NULL);
MutexHolder holder(_allocator->_lock);
LightMutexHolder holder(_allocator->_lock);
return (_next == _allocator) ? (SimpleAllocatorBlock *)NULL : (SimpleAllocatorBlock *)_next;
}

View File

@ -23,7 +23,7 @@ SimpleAllocator::
~SimpleAllocator() {
// We're shutting down. Force-free everything remaining.
if (_next != (LinkedListNode *)this) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
while (_next != (LinkedListNode *)this) {
nassertv(_next != (LinkedListNode *)NULL);
((SimpleAllocatorBlock *)_next)->do_free();
@ -38,7 +38,7 @@ SimpleAllocator::
////////////////////////////////////////////////////////////////////
void SimpleAllocator::
output(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
out << "SimpleAllocator, " << _total_size << " of " << _max_size
<< " allocated";
}
@ -50,7 +50,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
void SimpleAllocator::
write(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
out << "SimpleAllocator, " << _total_size << " of " << _max_size
<< " allocated";
@ -187,7 +187,7 @@ output(ostream &out) const {
if (_allocator == (SimpleAllocator *)NULL) {
out << "free block\n";
} else {
MutexHolder holder(_allocator->_lock);
LightMutexHolder holder(_allocator->_lock);
out << "block of size " << _size << " at " << _start;
}
}

View File

@ -17,8 +17,8 @@
#include "pandabase.h"
#include "linkedListNode.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
class SimpleAllocatorBlock;
@ -32,7 +32,7 @@ class SimpleAllocatorBlock;
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_GOBJ SimpleAllocator : public LinkedListNode {
PUBLISHED:
INLINE SimpleAllocator(size_t max_size, Mutex &lock);
INLINE SimpleAllocator(size_t max_size, LightMutex &lock);
virtual ~SimpleAllocator();
INLINE SimpleAllocatorBlock *alloc(size_t size);
@ -82,7 +82,7 @@ protected:
// A derived class may also use it to protect itself as well, but
// take care to call do_alloc() instead of alloc() etc. as
// necessary.
Mutex &_lock;
LightMutex &_lock;
friend class SimpleAllocatorBlock;
};

View File

@ -21,7 +21,7 @@
////////////////////////////////////////////////////////////////////
INLINE size_t SimpleLru::
get_total_size() const {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
return _total_size;
}
@ -33,7 +33,7 @@ get_total_size() const {
////////////////////////////////////////////////////////////////////
INLINE size_t SimpleLru::
get_max_size() const {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
return _max_size;
}
@ -47,7 +47,7 @@ get_max_size() const {
////////////////////////////////////////////////////////////////////
INLINE void SimpleLru::
set_max_size(size_t max_size) {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
_max_size = max_size;
if (_total_size > _max_size) {
do_evict_to(_max_size, false);
@ -61,7 +61,7 @@ set_max_size(size_t max_size) {
////////////////////////////////////////////////////////////////////
INLINE void SimpleLru::
consider_evict() {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
if (_total_size > _max_size) {
do_evict_to(_max_size, false);
}
@ -76,7 +76,7 @@ consider_evict() {
////////////////////////////////////////////////////////////////////
INLINE void SimpleLru::
evict_to(size_t target_size) {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
if (_total_size > target_size) {
do_evict_to(target_size, true);
}
@ -105,7 +105,7 @@ begin_epoch() {
////////////////////////////////////////////////////////////////////
INLINE bool SimpleLru::
validate() {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
return do_validate();
}
@ -151,7 +151,7 @@ operator = (const SimpleLruPage &copy) {
////////////////////////////////////////////////////////////////////
INLINE SimpleLru *SimpleLruPage::
get_lru() const {
MutexHolder holder(SimpleLru::_global_lock);
LightMutexHolder holder(SimpleLru::_global_lock);
return _lru;
}
@ -162,7 +162,7 @@ get_lru() const {
////////////////////////////////////////////////////////////////////
INLINE void SimpleLruPage::
dequeue_lru() {
MutexHolder holder(SimpleLru::_global_lock);
LightMutexHolder holder(SimpleLru::_global_lock);
if (_lru != (SimpleLru *)NULL) {
remove_from_list();
@ -217,7 +217,7 @@ get_lru_size() const {
////////////////////////////////////////////////////////////////////
INLINE void SimpleLruPage::
set_lru_size(size_t lru_size) {
MutexHolder holder(SimpleLru::_global_lock);
LightMutexHolder holder(SimpleLru::_global_lock);
if (_lru != (SimpleLru *)NULL) {
_lru->_total_size -= _lru_size;
_lru->_total_size += lru_size;

View File

@ -19,7 +19,7 @@
// a concrete object, so that it won't get destructed when the program
// exits. (If it did, there would be an ordering issue between it and
// the various concrete SimpleLru objects which reference it.)
Mutex &SimpleLru::_global_lock = *new Mutex;
LightMutex &SimpleLru::_global_lock = *new LightMutex;
////////////////////////////////////////////////////////////////////
// Function: SimpleLru::Constructor
@ -68,7 +68,7 @@ SimpleLru::
////////////////////////////////////////////////////////////////////
void SimpleLruPage::
enqueue_lru(SimpleLru *lru) {
MutexHolder holder(SimpleLru::_global_lock);
LightMutexHolder holder(SimpleLru::_global_lock);
if (_lru == lru) {
if (_lru != (SimpleLru *)NULL) {
@ -104,7 +104,7 @@ enqueue_lru(SimpleLru *lru) {
////////////////////////////////////////////////////////////////////
size_t SimpleLru::
count_active_size() const {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
size_t total = 0;
LinkedListNode *node = _prev;
@ -123,7 +123,7 @@ count_active_size() const {
////////////////////////////////////////////////////////////////////
void SimpleLru::
output(ostream &out) const {
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
out << "SimpleLru " << get_name()
<< ", " << _total_size << " of " << _max_size;
}
@ -141,7 +141,7 @@ write(ostream &out, int indent_level) const {
// the freshest in the LRU. Things at the end of the list will be
// the next to be evicted.
MutexHolder holder(_global_lock);
LightMutexHolder holder(_global_lock);
LinkedListNode *node = _prev;
while (node != _active_marker && node != this) {
SimpleLruPage *page = (SimpleLruPage *)node;

View File

@ -18,8 +18,8 @@
#include "pandabase.h"
#include "linkedListNode.h"
#include "namable.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
class SimpleLruPage;
@ -48,7 +48,7 @@ PUBLISHED:
void write(ostream &out, int indent_level) const;
public:
static Mutex &_global_lock;
static LightMutex &_global_lock;
private:
void do_evict_to(size_t target_size, bool hard_evict);

View File

@ -24,7 +24,7 @@
#include "texturePoolFilter.h"
#include "configVariableList.h"
#include "load_dso.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
TexturePool *TexturePool::_global_ptr;
@ -51,7 +51,7 @@ write(ostream &out) {
////////////////////////////////////////////////////////////////////
void TexturePool::
register_texture_type(MakeTextureFunc *func, const string &extensions) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
vector_string words;
extract_words(downcase(extensions), words);
@ -70,7 +70,7 @@ register_texture_type(MakeTextureFunc *func, const string &extensions) {
////////////////////////////////////////////////////////////////////
void TexturePool::
register_filter(TexturePoolFilter *filter) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
gobj_cat.info()
<< "Registering Texture filter " << *filter << "\n";
@ -87,7 +87,7 @@ register_filter(TexturePoolFilter *filter) {
////////////////////////////////////////////////////////////////////
TexturePool::MakeTextureFunc *TexturePool::
get_texture_type(const string &extension) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
string c = downcase(extension);
TypeRegistry::const_iterator ti;
@ -139,7 +139,7 @@ make_texture(const string &extension) const {
////////////////////////////////////////////////////////////////////
void TexturePool::
write_texture_types(ostream &out, int indent_level) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
PNMFileTypeRegistry *pnm_reg = PNMFileTypeRegistry::get_global_ptr();
pnm_reg->write(out, indent_level);
@ -206,7 +206,7 @@ TexturePool() {
////////////////////////////////////////////////////////////////////
bool TexturePool::
ns_has_texture(const Filename &orig_filename) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Filename filename(orig_filename);
@ -247,7 +247,7 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
vfs->resolve_filename(filename, get_model_path());
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Textures::const_iterator ti;
ti = _textures.find(filename);
if (ti != _textures.end()) {
@ -312,7 +312,7 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
tex->_texture_pool_key = filename;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// Now look again--someone may have just loaded this texture in
// another thread.
@ -375,7 +375,7 @@ ns_load_texture(const Filename &orig_filename,
vfs->resolve_filename(alpha_filename, get_model_path());
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Textures::const_iterator ti;
ti = _textures.find(filename);
@ -444,7 +444,7 @@ ns_load_texture(const Filename &orig_filename,
tex->_texture_pool_key = filename;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// Now look again.
Textures::const_iterator ti;
@ -494,7 +494,7 @@ ns_load_3d_texture(const Filename &filename_pattern,
vfs->resolve_filename(filename, get_model_path());
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Textures::const_iterator ti;
ti = _textures.find(filename);
@ -549,7 +549,7 @@ ns_load_3d_texture(const Filename &filename_pattern,
tex->_texture_pool_key = filename;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// Now look again.
Textures::const_iterator ti;
@ -588,7 +588,7 @@ ns_load_cube_map(const Filename &filename_pattern, bool read_mipmaps,
vfs->resolve_filename(filename, get_model_path());
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Textures::const_iterator ti;
ti = _textures.find(filename);
@ -643,7 +643,7 @@ ns_load_cube_map(const Filename &filename_pattern, bool read_mipmaps,
tex->_texture_pool_key = filename;
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// Now look again.
Textures::const_iterator ti;
@ -673,7 +673,7 @@ ns_load_cube_map(const Filename &filename_pattern, bool read_mipmaps,
////////////////////////////////////////////////////////////////////
Texture *TexturePool::
ns_get_normalization_cube_map(int size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_normalization_cube_map == (Texture *)NULL) {
_normalization_cube_map = new Texture("normalization_cube_map");
@ -693,7 +693,7 @@ ns_get_normalization_cube_map(int size) {
////////////////////////////////////////////////////////////////////
Texture *TexturePool::
ns_get_alpha_scale_map() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_alpha_scale_map == (Texture *)NULL) {
_alpha_scale_map = new Texture("alpha_scale_map");
@ -711,7 +711,7 @@ ns_get_alpha_scale_map() {
void TexturePool::
ns_add_texture(Texture *tex) {
PT(Texture) keep = tex;
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (!tex->_texture_pool_key.empty()) {
ns_release_texture(tex);
@ -734,7 +734,7 @@ ns_add_texture(Texture *tex) {
////////////////////////////////////////////////////////////////////
void TexturePool::
ns_release_texture(Texture *tex) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (!tex->_texture_pool_key.empty()) {
Textures::iterator ti;
@ -753,7 +753,7 @@ ns_release_texture(Texture *tex) {
////////////////////////////////////////////////////////////////////
void TexturePool::
ns_release_all_textures() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Textures::iterator ti;
for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
@ -772,7 +772,7 @@ ns_release_all_textures() {
////////////////////////////////////////////////////////////////////
int TexturePool::
ns_garbage_collect() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
int num_released = 0;
Textures new_set;
@ -814,7 +814,7 @@ ns_garbage_collect() {
////////////////////////////////////////////////////////////////////
void TexturePool::
ns_list_contents(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
int total_size;
int total_ram_size;
@ -985,7 +985,7 @@ pre_load(const Filename &orig_filename, const Filename &orig_alpha_filename,
bool read_mipmaps, const LoaderOptions &options) {
PT(Texture) tex;
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
FilterRegistry::iterator fi;
for (fi = _filter_registry.begin();
@ -1011,7 +1011,7 @@ PT(Texture) TexturePool::
post_load(Texture *tex) {
PT(Texture) result = tex;
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
FilterRegistry::iterator fi;
for (fi = _filter_registry.begin();

View File

@ -20,7 +20,7 @@
#include "filename.h"
#include "config_gobj.h"
#include "loaderOptions.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pmap.h"
class TexturePoolFilter;
@ -136,7 +136,7 @@ private:
static TexturePool *_global_ptr;
Mutex _lock;
LightMutex _lock;
typedef phash_map<string, PT(Texture), string_hash> Textures;
Textures _textures;
string _fake_texture_image;

View File

@ -21,7 +21,7 @@
////////////////////////////////////////////////////////////////////
INLINE VertexDataBlock *VertexDataBook::
alloc(size_t size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_alloc(size);
}

View File

@ -13,7 +13,7 @@
////////////////////////////////////////////////////////////////////
#include "vertexDataBook.h"
#include "reMutexHolder.h"
#include "lightReMutexHolder.h"
////////////////////////////////////////////////////////////////////
// Function: VertexDataBook::Constructor
@ -44,7 +44,7 @@ VertexDataBook::
////////////////////////////////////////////////////////////////////
size_t VertexDataBook::
count_total_page_size() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
size_t total = 0;
Pages::const_iterator pi;
@ -63,7 +63,7 @@ count_total_page_size() const {
////////////////////////////////////////////////////////////////////
size_t VertexDataBook::
count_total_page_size(VertexDataPage::RamClass ram_class) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
size_t total = 0;
Pages::const_iterator pi;
@ -83,7 +83,7 @@ count_total_page_size(VertexDataPage::RamClass ram_class) const {
////////////////////////////////////////////////////////////////////
size_t VertexDataBook::
count_allocated_size() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
size_t total = 0;
Pages::const_iterator pi;
@ -102,7 +102,7 @@ count_allocated_size() const {
////////////////////////////////////////////////////////////////////
size_t VertexDataBook::
count_allocated_size(VertexDataPage::RamClass ram_class) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
size_t total = 0;
Pages::const_iterator pi;
@ -124,7 +124,7 @@ count_allocated_size(VertexDataPage::RamClass ram_class) const {
////////////////////////////////////////////////////////////////////
void VertexDataBook::
save_to_disk() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Pages::iterator pi;
for (pi = _pages.begin(); pi != _pages.end(); ++pi) {

View File

@ -16,8 +16,8 @@
#define VERTEXDATABOOK_H
#include "pandabase.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
#include "vertexDataPage.h"
#include "indirectLess.h"
#include "plist.h"
@ -58,7 +58,7 @@ private:
typedef pset<VertexDataPage *, IndirectLess<VertexDataPage> > Pages;
Pages _pages;
Mutex _lock;
LightMutex _lock;
friend class VertexDataPage;
};

View File

@ -74,7 +74,7 @@ INLINE VertexDataBuffer::
////////////////////////////////////////////////////////////////////
INLINE const unsigned char *VertexDataBuffer::
get_read_pointer(bool force) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_resident_data != (unsigned char *)NULL || _size == 0) {
return _resident_data;
@ -95,7 +95,7 @@ get_read_pointer(bool force) const {
////////////////////////////////////////////////////////////////////
INLINE unsigned char *VertexDataBuffer::
get_write_pointer() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_resident_data == (unsigned char *)NULL && _size != 0) {
do_page_in();
@ -123,7 +123,7 @@ get_size() const {
////////////////////////////////////////////////////////////////////
INLINE void VertexDataBuffer::
clean_realloc(size_t size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
do_clean_realloc(size);
}
@ -136,7 +136,7 @@ clean_realloc(size_t size) {
////////////////////////////////////////////////////////////////////
INLINE void VertexDataBuffer::
unclean_realloc(size_t size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
do_unclean_realloc(size);
}
@ -162,7 +162,7 @@ clear() {
////////////////////////////////////////////////////////////////////
INLINE void VertexDataBuffer::
page_out(VertexDataBook &book) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
do_page_out(book);
}
@ -174,8 +174,8 @@ page_out(VertexDataBook &book) {
////////////////////////////////////////////////////////////////////
INLINE void VertexDataBuffer::
swap(VertexDataBuffer &other) {
MutexHolder holder(_lock);
MutexHolder holder2(other._lock);
LightMutexHolder holder(_lock);
LightMutexHolder holder2(other._lock);
unsigned char *resident_data = _resident_data;
size_t size = _size;

View File

@ -24,8 +24,8 @@ TypeHandle VertexDataBuffer::_type_handle;
////////////////////////////////////////////////////////////////////
void VertexDataBuffer::
operator = (const VertexDataBuffer &copy) {
MutexHolder holder(_lock);
MutexHolder holder2(copy._lock);
LightMutexHolder holder(_lock);
LightMutexHolder holder2(copy._lock);
if (_resident_data != (unsigned char *)NULL) {
nassertv(_size != 0);

View File

@ -21,8 +21,8 @@
#include "pointerTo.h"
#include "virtualFile.h"
#include "pStatCollector.h"
#include "pmutex.h"
#include "mutexHolder.h"
#include "lightMutex.h"
#include "lightMutexHolder.h"
////////////////////////////////////////////////////////////////////
// Class : VertexDataBuffer
@ -86,7 +86,7 @@ private:
unsigned char *_resident_data;
size_t _size;
PT(VertexDataBlock) _block;
Mutex _lock;
LightMutex _lock;
public:
static TypeHandle get_class_type() {

View File

@ -22,7 +22,7 @@
////////////////////////////////////////////////////////////////////
INLINE VertexDataPage::RamClass VertexDataPage::
get_ram_class() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _ram_class;
}
@ -36,7 +36,7 @@ get_ram_class() const {
////////////////////////////////////////////////////////////////////
INLINE VertexDataPage::RamClass VertexDataPage::
get_pending_ram_class() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _pending_ram_class;
}
@ -49,7 +49,7 @@ get_pending_ram_class() const {
////////////////////////////////////////////////////////////////////
INLINE void VertexDataPage::
request_resident() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_ram_class != RC_resident) {
request_ram_class(RC_resident);
}
@ -66,7 +66,7 @@ request_resident() {
////////////////////////////////////////////////////////////////////
INLINE VertexDataBlock *VertexDataPage::
alloc(size_t size) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_alloc(size);
}
@ -78,7 +78,7 @@ alloc(size_t size) {
////////////////////////////////////////////////////////////////////
INLINE VertexDataBlock *VertexDataPage::
get_first_block() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return (VertexDataBlock *)SimpleAllocator::get_first_block();
}
@ -142,7 +142,7 @@ get_save_file() {
////////////////////////////////////////////////////////////////////
INLINE bool VertexDataPage::
save_to_disk() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return do_save_to_disk();
}
@ -208,7 +208,7 @@ get_num_pending_writes() {
////////////////////////////////////////////////////////////////////
INLINE unsigned char *VertexDataPage::
get_page_data(bool force) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (_ram_class != RC_resident || _pending_ram_class != RC_resident) {
if (force) {
make_resident_now();

View File

@ -17,7 +17,7 @@
#include "vertexDataSaveFile.h"
#include "vertexDataBook.h"
#include "pStatTimer.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "memoryHook.h"
#ifdef HAVE_ZLIB
@ -68,9 +68,9 @@ SimpleLru *VertexDataPage::_global_lru[RC_end_of_list] = {
VertexDataSaveFile *VertexDataPage::_save_file;
// This mutex is (mostly) unused. We just need a Mutex to pass to the
// Book Constructor, below.
Mutex VertexDataPage::_unused_mutex;
// This mutex is (mostly) unused. We just need a LightMutex to pass
// to the Book Constructor, below.
LightMutex VertexDataPage::_unused_mutex;
PStatCollector VertexDataPage::_vdata_compress_pcollector("*:Vertex Data:Compress");
PStatCollector VertexDataPage::_vdata_decompress_pcollector("*:Vertex Data:Decompress");
@ -149,7 +149,7 @@ VertexDataPage::
// Since the only way to delete a page is via the
// changed_contiguous() method, the lock will already be held.
// MutexHolder holder(_lock);
// LightMutexHolder holder(_lock);
{
MutexHolder holder2(_tlock);
@ -287,7 +287,7 @@ changed_contiguous() {
////////////////////////////////////////////////////////////////////
void VertexDataPage::
evict_lru() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
switch (_ram_class) {
case RC_resident:
@ -1037,7 +1037,7 @@ thread_main() {
_tlock.release();
{
MutexHolder holder(_working_page->_lock);
LightMutexHolder holder(_working_page->_lock);
switch (ram_class) {
case RC_resident:
_working_page->make_resident();

View File

@ -21,10 +21,12 @@
#include "pStatCollector.h"
#include "vertexDataSaveFile.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "conditionVar.h"
#include "conditionVarFull.h"
#include "thread.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "pdeque.h"
class VertexDataBook;
@ -167,7 +169,7 @@ private:
size_t _book_size;
size_t _block_size;
//Mutex _lock; // Inherited from SimpleAllocator. Protects above members.
//LightMutex _lock; // Inherited from SimpleAllocator. Protects above members.
RamClass _pending_ram_class; // Protected by _tlock.
VertexDataBook *_book; // never changes.
@ -208,7 +210,7 @@ private:
static VertexDataSaveFile *_save_file;
static Mutex _unused_mutex;
static LightMutex _unused_mutex;
static PStatCollector _vdata_compress_pcollector;
static PStatCollector _vdata_decompress_pcollector;

View File

@ -13,7 +13,7 @@
////////////////////////////////////////////////////////////////////
#include "vertexDataSaveFile.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "clockObject.h"
#ifndef _WIN32
@ -189,7 +189,7 @@ VertexDataSaveFile::
////////////////////////////////////////////////////////////////////
PT(VertexDataSaveBlock) VertexDataSaveFile::
write_data(const unsigned char *data, size_t size, bool compressed) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (!_is_valid) {
return NULL;
@ -269,7 +269,7 @@ write_data(const unsigned char *data, size_t size, bool compressed) {
////////////////////////////////////////////////////////////////////
bool VertexDataSaveFile::
read_data(unsigned char *data, size_t size, VertexDataSaveBlock *block) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (!_is_valid) {
return false;

View File

@ -18,7 +18,7 @@
#include "pandabase.h"
#include "simpleAllocator.h"
#include "filename.h"
#include "pmutex.h"
#include "lightMutex.h"
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
@ -59,7 +59,7 @@ private:
Filename _filename;
bool _is_valid;
size_t _total_file_size;
Mutex _lock;
LightMutex _lock;
#ifdef _WIN32
HANDLE _handle;

View File

@ -13,12 +13,12 @@
////////////////////////////////////////////////////////////////////
#include "graphicsStateGuardianBase.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include <algorithm>
GraphicsStateGuardianBase::GSGs GraphicsStateGuardianBase::_gsgs;
GraphicsStateGuardianBase *GraphicsStateGuardianBase::_default_gsg;
Mutex GraphicsStateGuardianBase::_lock;
LightMutex GraphicsStateGuardianBase::_lock;
TypeHandle GraphicsStateGuardianBase::_type_handle;
////////////////////////////////////////////////////////////////////
@ -35,7 +35,7 @@ TypeHandle GraphicsStateGuardianBase::_type_handle;
////////////////////////////////////////////////////////////////////
GraphicsStateGuardianBase *GraphicsStateGuardianBase::
get_default_gsg() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _default_gsg;
}
@ -47,7 +47,7 @@ get_default_gsg() {
////////////////////////////////////////////////////////////////////
void GraphicsStateGuardianBase::
set_default_gsg(GraphicsStateGuardianBase *default_gsg) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (find(_gsgs.begin(), _gsgs.end(), default_gsg) == _gsgs.end()) {
// The specified GSG doesn't exist or it has already destructed.
nassertv(false);
@ -65,7 +65,7 @@ set_default_gsg(GraphicsStateGuardianBase *default_gsg) {
////////////////////////////////////////////////////////////////////
void GraphicsStateGuardianBase::
add_gsg(GraphicsStateGuardianBase *gsg) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
if (find(_gsgs.begin(), _gsgs.end(), gsg) != _gsgs.end()) {
// Already on the list.
@ -87,7 +87,7 @@ add_gsg(GraphicsStateGuardianBase *gsg) {
////////////////////////////////////////////////////////////////////
void GraphicsStateGuardianBase::
remove_gsg(GraphicsStateGuardianBase *gsg) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
GSGs::iterator gi = find(_gsgs.begin(), _gsgs.end(), gsg);
if (gi == _gsgs.end()) {

View File

@ -19,7 +19,7 @@
#include "typedWritableReferenceCount.h"
#include "luse.h"
#include "pmutex.h"
#include "lightMutex.h"
// A handful of forward references.
@ -222,7 +222,7 @@ private:
typedef pvector<GraphicsStateGuardianBase *> GSGs;
static GSGs _gsgs;
static GraphicsStateGuardianBase *_default_gsg;
static Mutex _lock;
static LightMutex _lock;
public:
static TypeHandle get_class_type() {

View File

@ -21,7 +21,7 @@
#include "config_express.h" // for collect_tcp
#include "trueClock.h"
#include "pnotify.h"
#include "reMutexHolder.h"
#include "lightReMutexHolder.h"
#include "socket_ip.h"
#include "socket_tcp.h"
#include "socket_udp.h"
@ -179,7 +179,7 @@ get_collect_tcp_interval() const {
////////////////////////////////////////////////////////////////////
bool Connection::
consider_flush() {
ReMutexHolder holder(_write_mutex);
LightReMutexHolder holder(_write_mutex);
if (!_collect_tcp) {
return do_flush();
@ -206,7 +206,7 @@ consider_flush() {
////////////////////////////////////////////////////////////////////
bool Connection::
flush() {
ReMutexHolder holder(_write_mutex);
LightReMutexHolder holder(_write_mutex);
return do_flush();
}
@ -361,7 +361,7 @@ send_datagram(const NetDatagram &datagram, int tcp_header_size) {
Socket_UDP *udp;
DCAST_INTO_R(udp, _socket, false);
ReMutexHolder holder(_write_mutex);
LightReMutexHolder holder(_write_mutex);
DatagramUDPHeader header(datagram);
string data;
data += header.get_header();
@ -403,7 +403,7 @@ send_datagram(const NetDatagram &datagram, int tcp_header_size) {
DatagramTCPHeader header(datagram, tcp_header_size);
ReMutexHolder holder(_write_mutex);
LightReMutexHolder holder(_write_mutex);
_queued_data += header.get_header();
_queued_data += datagram.get_message();
_queued_count++;
@ -438,7 +438,7 @@ send_raw_datagram(const NetDatagram &datagram) {
string data = datagram.get_message();
ReMutexHolder holder(_write_mutex);
LightReMutexHolder holder(_write_mutex);
Socket_Address addr = datagram.get_address().get_addr();
bool okflag = udp->SendTo(data, addr);
#if defined(HAVE_THREADS) && defined(SIMPLE_THREADS)
@ -459,7 +459,7 @@ send_raw_datagram(const NetDatagram &datagram) {
}
// We might queue up TCP packets for later sending.
ReMutexHolder holder(_write_mutex);
LightReMutexHolder holder(_write_mutex);
_queued_data += datagram.get_message();
_queued_count++;

View File

@ -18,7 +18,7 @@
#include "pandabase.h"
#include "referenceCount.h"
#include "netAddress.h"
#include "reMutex.h"
#include "lightReMutex.h"
class Socket_IP;
class ConnectionManager;
@ -67,7 +67,7 @@ private:
ConnectionManager *_manager;
Socket_IP *_socket;
ReMutex _write_mutex;
LightReMutex _write_mutex;
bool _collect_tcp;
double _collect_tcp_interval;

View File

@ -18,7 +18,7 @@
#include "connectionWriter.h"
#include "netAddress.h"
#include "config_net.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "trueClock.h"
#ifdef WIN32_VC
@ -238,7 +238,7 @@ close_connection(const PT(Connection) &connection) {
}
{
MutexHolder holder(_set_mutex);
LightMutexHolder holder(_set_mutex);
Connections::iterator ci = _connections.find(connection);
if (ci == _connections.end()) {
// Already closed, or not part of this ConnectionManager.
@ -295,7 +295,7 @@ get_host_name() {
////////////////////////////////////////////////////////////////////
void ConnectionManager::
new_connection(const PT(Connection) &connection) {
MutexHolder holder(_set_mutex);
LightMutexHolder holder(_set_mutex);
_connections.insert(connection);
}
@ -338,7 +338,7 @@ connection_reset(const PT(Connection) &connection, bool okflag) {
////////////////////////////////////////////////////////////////////
void ConnectionManager::
add_reader(ConnectionReader *reader) {
MutexHolder holder(_set_mutex);
LightMutexHolder holder(_set_mutex);
_readers.insert(reader);
}
@ -350,7 +350,7 @@ add_reader(ConnectionReader *reader) {
////////////////////////////////////////////////////////////////////
void ConnectionManager::
remove_reader(ConnectionReader *reader) {
MutexHolder holder(_set_mutex);
LightMutexHolder holder(_set_mutex);
_readers.erase(reader);
}
@ -362,7 +362,7 @@ remove_reader(ConnectionReader *reader) {
////////////////////////////////////////////////////////////////////
void ConnectionManager::
add_writer(ConnectionWriter *writer) {
MutexHolder holder(_set_mutex);
LightMutexHolder holder(_set_mutex);
_writers.insert(writer);
}
@ -374,6 +374,6 @@ add_writer(ConnectionWriter *writer) {
////////////////////////////////////////////////////////////////////
void ConnectionManager::
remove_writer(ConnectionWriter *writer) {
MutexHolder holder(_set_mutex);
LightMutexHolder holder(_set_mutex);
_writers.erase(writer);
}

View File

@ -21,7 +21,7 @@
#include "connection.h"
#include "pointerTo.h"
#include "pset.h"
#include "pmutex.h"
#include "lightMutex.h"
class NetAddress;
class ConnectionReader;
@ -76,7 +76,7 @@ protected:
Connections _connections;
Readers _readers;
Writers _writers;
Mutex _set_mutex;
LightMutex _set_mutex;
private:
friend class ConnectionReader;

View File

@ -21,7 +21,7 @@
#include "trueClock.h"
#include "socket_udp.h"
#include "socket_tcp.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include "pnotify.h"
#include "atomicAdjust.h"
@ -187,7 +187,7 @@ bool ConnectionReader::
add_connection(Connection *connection) {
nassertr(connection != (Connection *)NULL, false);
MutexHolder holder(_sockets_mutex);
LightMutexHolder holder(_sockets_mutex);
// Make sure it's not already on the _sockets list.
Sockets::const_iterator si;
@ -216,7 +216,7 @@ add_connection(Connection *connection) {
////////////////////////////////////////////////////////////////////
bool ConnectionReader::
remove_connection(Connection *connection) {
MutexHolder holder(_sockets_mutex);
LightMutexHolder holder(_sockets_mutex);
// Walk through the list of sockets to find the one we're removing.
Sockets::iterator si;
@ -247,7 +247,7 @@ remove_connection(Connection *connection) {
////////////////////////////////////////////////////////////////////
bool ConnectionReader::
is_connection_ok(Connection *connection) {
MutexHolder holder(_sockets_mutex);
LightMutexHolder holder(_sockets_mutex);
// Walk through the list of sockets to find the one we're asking
// about.
@ -784,7 +784,7 @@ ConnectionReader::SocketInfo *ConnectionReader::
get_next_available_socket(bool allow_block, int current_thread_index) {
// Go to sleep on the select() mutex. This guarantees that only one
// thread is in this function at a time.
MutexHolder holder(_select_mutex);
LightMutexHolder holder(_select_mutex);
do {
// First, check the result from the previous select call. If
@ -865,7 +865,7 @@ rebuild_select_list() {
_fdset.clear();
_selecting_sockets.clear();
MutexHolder holder(_sockets_mutex);
LightMutexHolder holder(_sockets_mutex);
Sockets::const_iterator si;
for (si = _sockets.begin(); si != _sockets.end(); ++si) {
SocketInfo *sinfo = (*si);

View File

@ -20,7 +20,7 @@
#include "connection.h"
#include "pointerTo.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pvector.h"
#include "pset.h"
#include "socket_fdset.h"
@ -147,7 +147,7 @@ private:
int _num_results;
// Threads go to sleep on this mutex waiting for their chance to
// read a socket.
Mutex _select_mutex;
LightMutex _select_mutex;
// This is atomically updated with the index (in _threads) of the
// thread that is currently waiting on the PR_Poll() call. It
@ -161,7 +161,7 @@ private:
// delete them until they're no longer _busy.
Sockets _removed_sockets;
// Any operations on _sockets are protected by this mutex.
Mutex _sockets_mutex;
LightMutex _sockets_mutex;
friend class ConnectionManager;

View File

@ -15,7 +15,7 @@
#include "queuedConnectionReader.h"
#include "config_net.h"
#include "trueClock.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
////////////////////////////////////////////////////////////////////
// Function: QueuedConnectionReader::Constructor
@ -141,7 +141,7 @@ receive_datagram(const NetDatagram &datagram) {
////////////////////////////////////////////////////////////////////
void QueuedConnectionReader::
start_delay(double min_delay, double max_delay) {
MutexHolder holder(_dd_mutex);
LightMutexHolder holder(_dd_mutex);
_min_delay = min_delay;
_delay_variance = max(max_delay - min_delay, 0.0);
_delay_active = true;
@ -156,7 +156,7 @@ start_delay(double min_delay, double max_delay) {
////////////////////////////////////////////////////////////////////
void QueuedConnectionReader::
stop_delay() {
MutexHolder holder(_dd_mutex);
LightMutexHolder holder(_dd_mutex);
_delay_active = false;
// Copy the entire contents of the delay queue to the normal queue.
@ -180,7 +180,7 @@ stop_delay() {
void QueuedConnectionReader::
get_delayed() {
if (_delay_active) {
MutexHolder holder(_dd_mutex);
LightMutexHolder holder(_dd_mutex);
double now = TrueClock::get_global_ptr()->get_short_time();
while (!_delayed.empty()) {
const DelayedDatagram &dd = _delayed.front();
@ -211,7 +211,7 @@ delay_datagram(const NetDatagram &datagram) {
<< "QueuedConnectionReader queue full!\n";
}
} else {
MutexHolder holder(_dd_mutex);
LightMutexHolder holder(_dd_mutex);
// Check the delay_active flag again, now that we have grabbed the
// mutex.
if (!_delay_active) {

View File

@ -20,7 +20,7 @@
#include "connectionReader.h"
#include "netDatagram.h"
#include "queuedReturn.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pdeque.h"
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_NET, EXPTP_PANDA_NET, QueuedReturn<NetDatagram>);
@ -62,7 +62,7 @@ private:
NetDatagram _datagram;
};
Mutex _dd_mutex;
LightMutex _dd_mutex;
typedef pdeque<DelayedDatagram> Delayed;
Delayed _delayed;
bool _delay_active;

View File

@ -28,7 +28,7 @@
template<class Thing>
void QueuedReturn<Thing>::
set_max_queue_size(int max_size) {
MutexHolder holder(_mutex);
LightMutexHolder holder(_mutex);
_max_queue_size = max_size;
}
@ -52,7 +52,7 @@ get_max_queue_size() const {
template<class Thing>
int QueuedReturn<Thing>::
get_current_queue_size() const {
MutexHolder holder(_mutex);
LightMutexHolder holder(_mutex);
int size = _things.size();
return size;
}
@ -134,7 +134,7 @@ thing_available() const {
template<class Thing>
bool QueuedReturn<Thing>::
get_thing(Thing &result) {
MutexHolder holder(_mutex);
LightMutexHolder holder(_mutex);
if (_things.empty()) {
// Huh. Nothing after all.
_available = false;
@ -157,7 +157,7 @@ get_thing(Thing &result) {
template<class Thing>
bool QueuedReturn<Thing>::
enqueue_thing(const Thing &thing) {
MutexHolder holder(_mutex);
LightMutexHolder holder(_mutex);
bool enqueue_ok = ((int)_things.size() < _max_queue_size);
if (enqueue_ok) {
_things.push_back(thing);
@ -181,7 +181,7 @@ enqueue_thing(const Thing &thing) {
template<class Thing>
bool QueuedReturn<Thing>::
enqueue_unique_thing(const Thing &thing) {
MutexHolder holder(_mutex);
LightMutexHolder holder(_mutex);
bool enqueue_ok = ((int)_things.size() < _max_queue_size);
if (enqueue_ok) {
if (find(_things.begin(), _things.end(), thing) == _things.end()) {

View File

@ -20,10 +20,10 @@
#include "connectionListener.h"
#include "connection.h"
#include "netAddress.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pdeque.h"
#include "config_net.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
#include <algorithm>
@ -55,7 +55,7 @@ protected:
bool enqueue_unique_thing(const Thing &thing);
private:
Mutex _mutex;
LightMutex _mutex;
pdeque<Thing> _things;
bool _available;
int _max_queue_size;

View File

@ -14,7 +14,7 @@
#include "recentConnectionReader.h"
#include "config_net.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
////////////////////////////////////////////////////////////////////
// Function: RecentConnectionReader::Constructor
@ -70,7 +70,7 @@ data_available() {
////////////////////////////////////////////////////////////////////
bool RecentConnectionReader::
get_data(NetDatagram &result) {
MutexHolder holder(_mutex);
LightMutexHolder holder(_mutex);
if (!_available) {
// Huh. Nothing after all.
return false;
@ -117,7 +117,7 @@ receive_datagram(const NetDatagram &datagram) {
<< " bytes\n";
}
MutexHolder holder(_mutex);
LightMutexHolder holder(_mutex);
_datagram = datagram;
_available = true;
}

View File

@ -19,7 +19,7 @@
#include "connectionReader.h"
#include "netDatagram.h"
#include "pmutex.h"
#include "lightMutex.h"
////////////////////////////////////////////////////////////////////
// Class : RecentConnectionReader
@ -48,7 +48,7 @@ protected:
private:
bool _available;
Datagram _datagram;
Mutex _mutex;
LightMutex _mutex;
};
#endif

View File

@ -13,7 +13,7 @@
////////////////////////////////////////////////////////////////////
#include "attribNodeRegistry.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
AttribNodeRegistry * TVOLATILE AttribNodeRegistry::_global_ptr;
@ -46,7 +46,7 @@ AttribNodeRegistry() {
void AttribNodeRegistry::
add_node(const NodePath &attrib_node) {
nassertv(!attrib_node.is_empty());
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
pair<Entries::iterator, bool> result = _entries.insert(Entry(attrib_node));
if (!result.second) {
@ -70,7 +70,7 @@ add_node(const NodePath &attrib_node) {
bool AttribNodeRegistry::
remove_node(const NodePath &attrib_node) {
nassertr(!attrib_node.is_empty(), false);
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Entries::iterator ei = _entries.find(Entry(attrib_node));
if (ei != _entries.end()) {
_entries.erase(ei);
@ -91,7 +91,7 @@ NodePath AttribNodeRegistry::
lookup_node(const NodePath &orig_node) const {
nassertr(!orig_node.is_empty(), orig_node);
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Entries::const_iterator ei = _entries.find(Entry(orig_node));
if (ei != _entries.end()) {
return (*ei)._node;
@ -106,7 +106,7 @@ lookup_node(const NodePath &orig_node) const {
////////////////////////////////////////////////////////////////////
int AttribNodeRegistry::
get_num_nodes() const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
return _entries.size();
}
@ -117,7 +117,7 @@ get_num_nodes() const {
////////////////////////////////////////////////////////////////////
NodePath AttribNodeRegistry::
get_node(int n) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertr(n >= 0 && n < (int)_entries.size(), NodePath());
return _entries[n]._node;
}
@ -130,7 +130,7 @@ get_node(int n) const {
////////////////////////////////////////////////////////////////////
TypeHandle AttribNodeRegistry::
get_node_type(int n) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertr(n >= 0 && n < (int)_entries.size(), TypeHandle::none());
return _entries[n]._type;
}
@ -146,7 +146,7 @@ get_node_type(int n) const {
////////////////////////////////////////////////////////////////////
string AttribNodeRegistry::
get_node_name(int n) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertr(n >= 0 && n < (int)_entries.size(), string());
return _entries[n]._name;
}
@ -163,7 +163,7 @@ get_node_name(int n) const {
int AttribNodeRegistry::
find_node(const NodePath &attrib_node) const {
nassertr(!attrib_node.is_empty(), -1);
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Entries::const_iterator ei = _entries.find(Entry(attrib_node));
if (ei != _entries.end()) {
return ei - _entries.begin();
@ -180,7 +180,7 @@ find_node(const NodePath &attrib_node) const {
////////////////////////////////////////////////////////////////////
int AttribNodeRegistry::
find_node(TypeHandle type, const string &name) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Entries::const_iterator ei = _entries.find(Entry(type, name));
if (ei != _entries.end()) {
return ei - _entries.begin();
@ -195,7 +195,7 @@ find_node(TypeHandle type, const string &name) const {
////////////////////////////////////////////////////////////////////
void AttribNodeRegistry::
remove_node(int n) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
nassertv(n >= 0 && n < (int)_entries.size());
_entries.erase(_entries.begin() + n);
}
@ -207,7 +207,7 @@ remove_node(int n) {
////////////////////////////////////////////////////////////////////
void AttribNodeRegistry::
clear() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_entries.clear();
}
@ -218,7 +218,7 @@ clear() {
////////////////////////////////////////////////////////////////////
void AttribNodeRegistry::
output(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
typedef pmap<TypeHandle, int> Counts;
Counts counts;
@ -251,7 +251,7 @@ output(ostream &out) const {
////////////////////////////////////////////////////////////////////
void AttribNodeRegistry::
write(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Entries::const_iterator ei;
for (ei = _entries.begin(); ei != _entries.end(); ++ei) {

View File

@ -18,7 +18,7 @@
#include "pandabase.h"
#include "nodePath.h"
#include "ordered_vector.h"
#include "pmutex.h"
#include "lightMutex.h"
////////////////////////////////////////////////////////////////////
// Class : AttribNodeRegistry
@ -76,7 +76,7 @@ private:
typedef ov_set<Entry> Entries;
Entries _entries;
Mutex _lock;
LightMutex _lock;
static AttribNodeRegistry * TVOLATILE _global_ptr;
};

View File

@ -15,7 +15,7 @@
#include "modelPool.h"
#include "loader.h"
#include "config_pgraph.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
ModelPool *ModelPool::_global_ptr = (ModelPool *)NULL;
@ -39,7 +39,7 @@ write(ostream &out) {
////////////////////////////////////////////////////////////////////
bool ModelPool::
ns_has_model(const string &filename) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Models::const_iterator ti;
ti = _models.find(filename);
if (ti != _models.end() && (*ti).second != (ModelRoot *)NULL) {
@ -58,7 +58,7 @@ ns_has_model(const string &filename) {
ModelRoot *ModelPool::
ns_load_model(const string &filename, const LoaderOptions &options) {
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Models::const_iterator ti;
ti = _models.find(filename);
if (ti != _models.end()) {
@ -91,7 +91,7 @@ ns_load_model(const string &filename, const LoaderOptions &options) {
}
{
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// Look again, in case someone has just loaded the model in
// another thread.
@ -115,7 +115,7 @@ ns_load_model(const string &filename, const LoaderOptions &options) {
////////////////////////////////////////////////////////////////////
void ModelPool::
ns_add_model(const string &filename, ModelRoot *model) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// We blow away whatever model was there previously, if any.
_models[filename] = model;
}
@ -127,7 +127,7 @@ ns_add_model(const string &filename, ModelRoot *model) {
////////////////////////////////////////////////////////////////////
void ModelPool::
ns_release_model(const string &filename) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Models::iterator ti;
ti = _models.find(filename);
if (ti != _models.end()) {
@ -142,7 +142,7 @@ ns_release_model(const string &filename) {
////////////////////////////////////////////////////////////////////
void ModelPool::
ns_add_model(ModelRoot *model) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
// We blow away whatever model was there previously, if any.
_models[model->get_fullpath()] = model;
}
@ -154,7 +154,7 @@ ns_add_model(ModelRoot *model) {
////////////////////////////////////////////////////////////////////
void ModelPool::
ns_release_model(ModelRoot *model) {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
Models::iterator ti;
ti = _models.find(model->get_fullpath());
if (ti != _models.end()) {
@ -169,7 +169,7 @@ ns_release_model(ModelRoot *model) {
////////////////////////////////////////////////////////////////////
void ModelPool::
ns_release_all_models() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
_models.clear();
}
@ -180,7 +180,7 @@ ns_release_all_models() {
////////////////////////////////////////////////////////////////////
int ModelPool::
ns_garbage_collect() {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
int num_released = 0;
Models new_set;
@ -211,7 +211,7 @@ ns_garbage_collect() {
////////////////////////////////////////////////////////////////////
void ModelPool::
ns_list_contents(ostream &out) const {
MutexHolder holder(_lock);
LightMutexHolder holder(_lock);
out << "model pool contents:\n";

View File

@ -20,7 +20,7 @@
#include "filename.h"
#include "modelRoot.h"
#include "pointerTo.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "pmap.h"
#include "loaderOptions.h"
@ -86,7 +86,7 @@ private:
static ModelPool *_global_ptr;
Mutex _lock;
LightMutex _lock;
typedef pmap<string, PT(ModelRoot) > Models;
Models _models;
};

View File

@ -13,12 +13,12 @@
////////////////////////////////////////////////////////////////////
#include "nodePathComponent.h"
#include "mutexHolder.h"
#include "lightMutexHolder.h"
// We start the key counters off at 1, since 0 is reserved for an
// empty NodePath (and also for an unassigned key).
int NodePathComponent::_next_key = 1;
Mutex NodePathComponent::_key_lock("NodePathComponent::_key_lock");
LightMutex NodePathComponent::_key_lock("NodePathComponent::_key_lock");
TypeHandle NodePathComponent::_type_handle;
TypeHandle NodePathComponent::CData::_type_handle;
@ -72,7 +72,7 @@ NodePathComponent(PandaNode *node, NodePathComponent *next,
////////////////////////////////////////////////////////////////////
int NodePathComponent::
get_key() const {
MutexHolder holder(_key_lock);
LightMutexHolder holder(_key_lock);
if (_key == 0) {
// The first time someone asks for a particular component's key,
// we make it up on the spot. This helps keep us from wasting

View File

@ -26,7 +26,7 @@
#include "cycleDataLockedStageReader.h"
#include "cycleDataStageReader.h"
#include "cycleDataStageWriter.h"
#include "pmutex.h"
#include "lightMutex.h"
#include "deletedChain.h"
////////////////////////////////////////////////////////////////////
@ -113,7 +113,7 @@ private:
typedef CycleDataStageWriter<CData> CDStageWriter;
static int _next_key;
static Mutex _key_lock;
static LightMutex _key_lock;
public:
static TypeHandle get_class_type() {

Some files were not shown because too many files have changed in this diff Show More