Author: ArcRiley
Date: 2008-03-06 12:52:49 -0500 (Thu, 06 Mar 2008)
New Revision: 1065

Modified:
   trunk/pysoy/src/atoms/Vertex.pxi
   trunk/pysoy/src/atoms/soy.atoms.pxd
   trunk/pysoy/src/meshes/Mesh.pxi
   trunk/pysoy/src/meshes/soy.meshes.pxd
Log:
Ticket #901 :
  * created a Mesh._mutex 
  * started implementing this in Vertex as an example


Modified: trunk/pysoy/src/atoms/Vertex.pxi
===================================================================
--- trunk/pysoy/src/atoms/Vertex.pxi    2008-03-06 16:44:13 UTC (rev 1064)
+++ trunk/pysoy/src/atoms/Vertex.pxi    2008-03-06 17:52:49 UTC (rev 1065)
@@ -26,28 +26,27 @@
               position=None, normal=None, texcoord=None, tangent=None,
               index=-1, *args, **keywords) :
     self._index = -1
-    self._list = mesh._verts
+    self._list  = mesh._verts
+    self._mutex = mesh._mutex
     if index >= 0 :
+      #
       # For an instance of an existing vertex
       if index >= self._list._arraySize :
         raise ValueError('index out of range')
-      ##self._list._children.lock()
-      self._list._children._stepLock()
+      py.PyThread_acquire_lock(self._mutex, 1)
       self._list._children._append(<void*> self)
       self._index = index
-      #self._list._children.unlock()
-      self._list._children._stepUnlock()
+      py.PyThread_release_lock(self._mutex)
     else :
+      #
       # For a brand new vertex
-      ##self._list._children.lock()
-      self._list._children._stepLock()
+      py.PyThread_acquire_lock(self._mutex, 1)
       self._list._children._append(<void*> self)
       self._index = self._list._arraySize
       self._list._arraySize = self._list._arraySize + 1
       self._list._allocArray (self._list._arraySize)
       self._list._flagUpdated(self._index)
-      ##self._list._children.unlock()
-      self._list._children._stepUnlock()
+      py.PyThread_release_lock(self._mutex)
     if position :
       self.position = position
     if normal :

Modified: trunk/pysoy/src/atoms/soy.atoms.pxd
===================================================================
--- trunk/pysoy/src/atoms/soy.atoms.pxd 2008-03-06 16:44:13 UTC (rev 1064)
+++ trunk/pysoy/src/atoms/soy.atoms.pxd 2008-03-06 17:52:49 UTC (rev 1065)
@@ -27,10 +27,12 @@
 cdef class Vertex :
   cdef soy._datatypes.VertexList  _list
   cdef int                        _index
+  cdef void*                      _mutex
 
 
 cdef class Face :
   cdef soy._datatypes.FaceList    _list
   cdef int                        _index
+  cdef void*                      _mutex
 
 

Modified: trunk/pysoy/src/meshes/Mesh.pxi
===================================================================
--- trunk/pysoy/src/meshes/Mesh.pxi     2008-03-06 16:44:13 UTC (rev 1064)
+++ trunk/pysoy/src/meshes/Mesh.pxi     2008-03-06 17:52:49 UTC (rev 1065)
@@ -26,8 +26,13 @@
     self._mates = soy._datatypes.MaterialList(self)
     self._faces = soy._datatypes.FaceList(self)
     self._verts = soy._datatypes.VertexList(self)
+    self._mutex = py.PyThread_allocate_lock()
 
 
+  def __dealloc__(self) :
+    py.PyThread_free_lock(self._mutex)
+
+
   def __repr__(self) :
     return '<Mesh with %d verticies, %d faces, and %d materials>' % (
              len(self._verts), len(self._faces), len(self._mates))
@@ -86,7 +91,9 @@
   # then rendered.
 
   cdef void _coreRender(self, void* _body) :
+    py.PyThread_acquire_lock(self._mutex, 1)
     if gl.GLEW_ARB_vertex_buffer_object :
       self._mates._coreRenderBuffer(_body)
     else :
       self._mates._coreRenderArray(_body)
+    py.PyThread_release_lock(self._mutex)

Modified: trunk/pysoy/src/meshes/soy.meshes.pxd
===================================================================
--- trunk/pysoy/src/meshes/soy.meshes.pxd       2008-03-06 16:44:13 UTC (rev 
1064)
+++ trunk/pysoy/src/meshes/soy.meshes.pxd       2008-03-06 17:52:49 UTC (rev 
1065)
@@ -31,7 +31,8 @@
   cdef soy._datatypes.MaterialList  _mates
   cdef soy._datatypes.FaceList      _faces
   cdef soy._datatypes.VertexList    _verts
-  cdef void          _coreRender        ( self, void* )
+  cdef void*                        _mutex
+  cdef void                         _coreRender        ( self, void* )
 
 cdef class Shape (Mesh) :
   cdef soy.materials.Material       _material

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to