diff --git a/panda/src/gobj/geomVertexArrayData.h b/panda/src/gobj/geomVertexArrayData.h index 2ca951d382..52ff617f34 100644 --- a/panda/src/gobj/geomVertexArrayData.h +++ b/panda/src/gobj/geomVertexArrayData.h @@ -28,7 +28,7 @@ #include "cycleDataStageWriter.h" #include "pipelineCycler.h" #include "pmap.h" -#include "lightReMutex.h" +#include "reMutex.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. - LightReMutex _rw_lock; + ReMutex _rw_lock; public: static TypeHandle get_class_type() { diff --git a/panda/src/gobj/simpleAllocator.I b/panda/src/gobj/simpleAllocator.I index f51ee911a7..e42694f14a 100644 --- a/panda/src/gobj/simpleAllocator.I +++ b/panda/src/gobj/simpleAllocator.I @@ -19,7 +19,7 @@ // Description: //////////////////////////////////////////////////////////////////// INLINE SimpleAllocator:: -SimpleAllocator(size_t max_size, LightMutex &lock) : +SimpleAllocator(size_t max_size, Mutex &lock) : LinkedListNode(true), _total_size(0), _max_size(max_size), @@ -39,7 +39,7 @@ SimpleAllocator(size_t max_size, LightMutex &lock) : //////////////////////////////////////////////////////////////////// SimpleAllocatorBlock *SimpleAllocator:: alloc(size_t size) { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return do_alloc(size); } @@ -51,7 +51,7 @@ alloc(size_t size) { //////////////////////////////////////////////////////////////////// INLINE bool SimpleAllocator:: is_empty() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return do_is_empty(); } @@ -62,7 +62,7 @@ is_empty() const { //////////////////////////////////////////////////////////////////// INLINE size_t SimpleAllocator:: get_total_size() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return _total_size; } @@ -73,7 +73,7 @@ get_total_size() const { //////////////////////////////////////////////////////////////////// INLINE size_t SimpleAllocator:: get_max_size() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return _max_size; } @@ -86,7 +86,7 @@ get_max_size() const { //////////////////////////////////////////////////////////////////// INLINE void SimpleAllocator:: set_max_size(size_t max_size) { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); _max_size = max_size; } @@ -102,7 +102,7 @@ set_max_size(size_t max_size) { //////////////////////////////////////////////////////////////////// INLINE size_t SimpleAllocator:: get_contiguous() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return _contiguous; } @@ -114,7 +114,7 @@ get_contiguous() const { //////////////////////////////////////////////////////////////////// INLINE SimpleAllocatorBlock *SimpleAllocator:: get_first_block() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return (_next == this) ? (SimpleAllocatorBlock *)NULL : (SimpleAllocatorBlock *)_next; } @@ -194,7 +194,7 @@ INLINE SimpleAllocatorBlock:: INLINE void SimpleAllocatorBlock:: free() { if (_allocator != (SimpleAllocator *)NULL) { - LightMutexHolder holder(_allocator->_lock); + MutexHolder 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); - LightMutexHolder holder(_allocator->_lock); + MutexHolder 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); - LightMutexHolder holder(_allocator->_lock); + MutexHolder 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); - LightMutexHolder holder(_allocator->_lock); + MutexHolder holder(_allocator->_lock); return (_next == _allocator) ? (SimpleAllocatorBlock *)NULL : (SimpleAllocatorBlock *)_next; } diff --git a/panda/src/gobj/simpleAllocator.cxx b/panda/src/gobj/simpleAllocator.cxx index b129090ffa..8b0bd2a1de 100644 --- a/panda/src/gobj/simpleAllocator.cxx +++ b/panda/src/gobj/simpleAllocator.cxx @@ -23,7 +23,7 @@ SimpleAllocator:: ~SimpleAllocator() { // We're shutting down. Force-free everything remaining. if (_next != (LinkedListNode *)this) { - LightMutexHolder holder(_lock); + MutexHolder 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 { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); out << "SimpleAllocator, " << _total_size << " of " << _max_size << " allocated"; } @@ -50,7 +50,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// void SimpleAllocator:: write(ostream &out) const { - LightMutexHolder holder(_lock); + MutexHolder 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 { - LightMutexHolder holder(_allocator->_lock); + MutexHolder holder(_allocator->_lock); out << "block of size " << _size << " at " << _start; } } diff --git a/panda/src/gobj/simpleAllocator.h b/panda/src/gobj/simpleAllocator.h index 7a36373f0f..f494697bec 100644 --- a/panda/src/gobj/simpleAllocator.h +++ b/panda/src/gobj/simpleAllocator.h @@ -17,8 +17,8 @@ #include "pandabase.h" #include "linkedListNode.h" -#include "lightMutex.h" -#include "lightMutexHolder.h" +#include "pmutex.h" +#include "mutexHolder.h" class SimpleAllocatorBlock; @@ -32,7 +32,7 @@ class SimpleAllocatorBlock; //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_GOBJ SimpleAllocator : public LinkedListNode { PUBLISHED: - INLINE SimpleAllocator(size_t max_size, LightMutex &lock); + INLINE SimpleAllocator(size_t max_size, Mutex &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. - LightMutex &_lock; + Mutex &_lock; friend class SimpleAllocatorBlock; }; diff --git a/panda/src/gobj/vertexDataBook.I b/panda/src/gobj/vertexDataBook.I index edcc6bf820..30e6f01ef4 100644 --- a/panda/src/gobj/vertexDataBook.I +++ b/panda/src/gobj/vertexDataBook.I @@ -21,7 +21,7 @@ //////////////////////////////////////////////////////////////////// INLINE VertexDataBlock *VertexDataBook:: alloc(size_t size) { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return do_alloc(size); } diff --git a/panda/src/gobj/vertexDataBook.cxx b/panda/src/gobj/vertexDataBook.cxx index 6465d4e684..6b0aa07ff0 100644 --- a/panda/src/gobj/vertexDataBook.cxx +++ b/panda/src/gobj/vertexDataBook.cxx @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "vertexDataBook.h" -#include "lightReMutexHolder.h" +#include "mutexHolder.h" //////////////////////////////////////////////////////////////////// // Function: VertexDataBook::Constructor @@ -44,7 +44,7 @@ VertexDataBook:: //////////////////////////////////////////////////////////////////// size_t VertexDataBook:: count_total_page_size() const { - LightMutexHolder holder(_lock); + MutexHolder 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 { - LightMutexHolder holder(_lock); + MutexHolder 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 { - LightMutexHolder holder(_lock); + MutexHolder 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 { - LightMutexHolder holder(_lock); + MutexHolder 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() { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); Pages::iterator pi; for (pi = _pages.begin(); pi != _pages.end(); ++pi) { diff --git a/panda/src/gobj/vertexDataBook.h b/panda/src/gobj/vertexDataBook.h index c1617857ac..4f5754138b 100644 --- a/panda/src/gobj/vertexDataBook.h +++ b/panda/src/gobj/vertexDataBook.h @@ -16,8 +16,8 @@ #define VERTEXDATABOOK_H #include "pandabase.h" -#include "lightMutex.h" -#include "lightMutexHolder.h" +#include "pmutex.h" +#include "mutexHolder.h" #include "vertexDataPage.h" #include "indirectLess.h" #include "plist.h" @@ -58,7 +58,7 @@ private: typedef pset > Pages; Pages _pages; - LightMutex _lock; + Mutex _lock; friend class VertexDataPage; }; diff --git a/panda/src/gobj/vertexDataPage.I b/panda/src/gobj/vertexDataPage.I index aa103376eb..947efbd278 100644 --- a/panda/src/gobj/vertexDataPage.I +++ b/panda/src/gobj/vertexDataPage.I @@ -22,7 +22,7 @@ //////////////////////////////////////////////////////////////////// INLINE VertexDataPage::RamClass VertexDataPage:: get_ram_class() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return _ram_class; } @@ -36,7 +36,7 @@ get_ram_class() const { //////////////////////////////////////////////////////////////////// INLINE VertexDataPage::RamClass VertexDataPage:: get_pending_ram_class() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return _pending_ram_class; } @@ -49,7 +49,7 @@ get_pending_ram_class() const { //////////////////////////////////////////////////////////////////// INLINE void VertexDataPage:: request_resident() { - LightMutexHolder holder(_lock); + MutexHolder 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) { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return do_alloc(size); } @@ -78,7 +78,7 @@ alloc(size_t size) { //////////////////////////////////////////////////////////////////// INLINE VertexDataBlock *VertexDataPage:: get_first_block() const { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return (VertexDataBlock *)SimpleAllocator::get_first_block(); } @@ -142,7 +142,7 @@ get_save_file() { //////////////////////////////////////////////////////////////////// INLINE bool VertexDataPage:: save_to_disk() { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); return do_save_to_disk(); } @@ -208,7 +208,7 @@ get_num_pending_writes() { //////////////////////////////////////////////////////////////////// INLINE unsigned char *VertexDataPage:: get_page_data(bool force) { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); if (_ram_class != RC_resident || _pending_ram_class != RC_resident) { if (force) { make_resident_now(); diff --git a/panda/src/gobj/vertexDataPage.cxx b/panda/src/gobj/vertexDataPage.cxx index 162b1ea153..65694081e2 100644 --- a/panda/src/gobj/vertexDataPage.cxx +++ b/panda/src/gobj/vertexDataPage.cxx @@ -17,7 +17,6 @@ #include "vertexDataSaveFile.h" #include "vertexDataBook.h" #include "pStatTimer.h" -#include "lightMutexHolder.h" #include "memoryHook.h" #ifdef HAVE_ZLIB @@ -72,9 +71,9 @@ SimpleLru *VertexDataPage::_global_lru[RC_end_of_list] = { VertexDataSaveFile *VertexDataPage::_save_file; -// This mutex is (mostly) unused. We just need a LightMutex to pass +// This mutex is (mostly) unused. We just need a Mutex to pass // to the Book Constructor, below. -LightMutex VertexDataPage::_unused_mutex; +Mutex VertexDataPage::_unused_mutex; PStatCollector VertexDataPage::_vdata_compress_pcollector("*:Vertex Data:Compress"); PStatCollector VertexDataPage::_vdata_decompress_pcollector("*:Vertex Data:Decompress"); @@ -153,7 +152,7 @@ VertexDataPage:: // Since the only way to delete a page is via the // changed_contiguous() method, the lock will already be held. - // LightMutexHolder holder(_lock); + // MutexHolder holder(_lock); { MutexHolder holder2(_tlock); @@ -291,7 +290,7 @@ changed_contiguous() { //////////////////////////////////////////////////////////////////// void VertexDataPage:: evict_lru() { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); switch (_ram_class) { case RC_resident: @@ -1041,7 +1040,7 @@ thread_main() { _tlock.release(); { - LightMutexHolder holder(_working_page->_lock); + MutexHolder holder(_working_page->_lock); switch (ram_class) { case RC_resident: _working_page->make_resident(); diff --git a/panda/src/gobj/vertexDataPage.h b/panda/src/gobj/vertexDataPage.h index e3bf8ffb0f..a6a6e4eafb 100644 --- a/panda/src/gobj/vertexDataPage.h +++ b/panda/src/gobj/vertexDataPage.h @@ -21,12 +21,10 @@ #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; @@ -169,7 +167,7 @@ private: size_t _book_size; size_t _block_size; - //LightMutex _lock; // Inherited from SimpleAllocator. Protects above members. + //Mutex _lock; // Inherited from SimpleAllocator. Protects above members. RamClass _pending_ram_class; // Protected by _tlock. VertexDataBook *_book; // never changes. @@ -210,7 +208,7 @@ private: static VertexDataSaveFile *_save_file; - static LightMutex _unused_mutex; + static Mutex _unused_mutex; static PStatCollector _vdata_compress_pcollector; static PStatCollector _vdata_decompress_pcollector; diff --git a/panda/src/gobj/vertexDataSaveFile.cxx b/panda/src/gobj/vertexDataSaveFile.cxx index a7616d091c..0f3ec5c464 100644 --- a/panda/src/gobj/vertexDataSaveFile.cxx +++ b/panda/src/gobj/vertexDataSaveFile.cxx @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "vertexDataSaveFile.h" -#include "lightMutexHolder.h" +#include "mutexHolder.h" #include "clockObject.h" #ifndef _WIN32 @@ -192,7 +192,7 @@ VertexDataSaveFile:: //////////////////////////////////////////////////////////////////// PT(VertexDataSaveBlock) VertexDataSaveFile:: write_data(const unsigned char *data, size_t size, bool compressed) { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); if (!_is_valid) { return NULL; @@ -272,7 +272,7 @@ write_data(const unsigned char *data, size_t size, bool compressed) { //////////////////////////////////////////////////////////////////// bool VertexDataSaveFile:: read_data(unsigned char *data, size_t size, VertexDataSaveBlock *block) { - LightMutexHolder holder(_lock); + MutexHolder holder(_lock); if (!_is_valid) { return false; diff --git a/panda/src/gobj/vertexDataSaveFile.h b/panda/src/gobj/vertexDataSaveFile.h index 0daa681eb3..948d8a7ba8 100644 --- a/panda/src/gobj/vertexDataSaveFile.h +++ b/panda/src/gobj/vertexDataSaveFile.h @@ -18,7 +18,7 @@ #include "pandabase.h" #include "simpleAllocator.h" #include "filename.h" -#include "lightMutex.h" +#include "pmutex.h" #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN @@ -59,7 +59,7 @@ private: Filename _filename; bool _is_valid; size_t _total_file_size; - LightMutex _lock; + Mutex _lock; #ifdef _WIN32 HANDLE _handle;