فهرست منبع

Fix compilation when building without threads enabled

rdb 8 سال پیش
والد
کامیت
4f299fa71f
2فایلهای تغییر یافته به همراه54 افزوده شده و 0 حذف شده
  1. 50 0
      panda/src/gobj/geomVertexArrayData.I
  2. 4 0
      panda/src/gobj/geomVertexArrayData.h

+ 50 - 0
panda/src/gobj/geomVertexArrayData.I

@@ -283,6 +283,31 @@ GeomVertexArrayDataHandle(CPT(GeomVertexArrayData) object,
 #endif
 #endif
 }
 }
 
 
+/**
+ *
+ */
+INLINE GeomVertexArrayDataHandle::
+GeomVertexArrayDataHandle(const GeomVertexArrayData *object,
+                          Thread *current_thread) :
+  _object((GeomVertexArrayData *)object),
+  _current_thread(current_thread),
+  _cdata((GeomVertexArrayData::CData *)object->_cycler.read_unlocked(current_thread)),
+  _writable(false)
+{
+#ifdef _DEBUG
+  nassertv(_object->test_ref_count_nonzero());
+#endif // _DEBUG
+#ifdef DO_PIPELINING
+  _cdata->ref();
+#endif  // DO_PIPELINING
+  // We must grab the lock *after* we have incremented the reference count,
+  // above.
+  _cdata->_rw_lock.acquire();
+#ifdef DO_MEMORY_USAGE
+  MemoryUsage::update_type(this, get_class_type());
+#endif
+}
+
 /**
 /**
  *
  *
  */
  */
@@ -309,6 +334,31 @@ GeomVertexArrayDataHandle(PT(GeomVertexArrayData) object,
 #endif
 #endif
 }
 }
 
 
+/**
+ *
+ */
+INLINE GeomVertexArrayDataHandle::
+GeomVertexArrayDataHandle(GeomVertexArrayData *object,
+                          Thread *current_thread) :
+  _object(object),
+  _current_thread(current_thread),
+  _cdata(object->_cycler.write_upstream(true, current_thread)),
+  _writable(true)
+{
+#ifdef _DEBUG
+  nassertv(_object->test_ref_count_nonzero());
+#endif // _DEBUG
+#ifdef DO_PIPELINING
+  _cdata->ref();
+#endif  // DO_PIPELINING
+  // We must grab the lock *after* we have incremented the reference count,
+  // above.
+  _cdata->_rw_lock.acquire();
+#ifdef DO_MEMORY_USAGE
+  MemoryUsage::update_type(this, get_class_type());
+#endif
+}
+
 /**
 /**
  * Don't attempt to copy these objects.
  * Don't attempt to copy these objects.
  */
  */

+ 4 - 0
panda/src/gobj/geomVertexArrayData.h

@@ -250,8 +250,12 @@ class EXPCL_PANDA_GOBJ GeomVertexArrayDataHandle : public ReferenceCount, public
 private:
 private:
   INLINE GeomVertexArrayDataHandle(CPT(GeomVertexArrayData) object,
   INLINE GeomVertexArrayDataHandle(CPT(GeomVertexArrayData) object,
                                    Thread *current_thread);
                                    Thread *current_thread);
+  INLINE GeomVertexArrayDataHandle(const GeomVertexArrayData *object,
+                                   Thread *current_thread);
   INLINE GeomVertexArrayDataHandle(PT(GeomVertexArrayData) object,
   INLINE GeomVertexArrayDataHandle(PT(GeomVertexArrayData) object,
                                    Thread *current_thread);
                                    Thread *current_thread);
+  INLINE GeomVertexArrayDataHandle(GeomVertexArrayData *object,
+                                   Thread *current_thread);
   INLINE GeomVertexArrayDataHandle(const GeomVertexArrayDataHandle &);
   INLINE GeomVertexArrayDataHandle(const GeomVertexArrayDataHandle &);
   INLINE void operator = (const GeomVertexArrayDataHandle &);
   INLINE void operator = (const GeomVertexArrayDataHandle &);