Author: DerekRhodes Date: 2008-03-06 13:18:27 -0500 (Thu, 06 Mar 2008) New Revision: 1066
Modified: trunk/pysoy/src/atoms/Face.pxi trunk/pysoy/src/atoms/Vertex.pxi Log: Ticket #901 changed erroneous _stepLock calls to py.PyThread_acquire_lock Modified: trunk/pysoy/src/atoms/Face.pxi =================================================================== --- trunk/pysoy/src/atoms/Face.pxi 2008-03-06 17:52:49 UTC (rev 1065) +++ trunk/pysoy/src/atoms/Face.pxi 2008-03-06 18:18:27 UTC (rev 1066) @@ -28,6 +28,8 @@ cdef int i, _mindex self._index = -1 self._list = mesh._faces + self._mutex = mesh._mutex + if index >= 0 : # For an instance of an existing face if index >= self._list._arraySize : @@ -40,10 +42,7 @@ raise TypeError('must provide verticies and material for a new Face') if not isinstance(material, soy.materials.Material) : raise TypeError('material must be of type soy.materials.Material') - ##self._list._children.lock() - ##mesh._mates._children.lock() - self._list._children._stepLock() - mesh._mates._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) self._list._children._append(<void*> self) self._list._allocArray(self._list._arraySize + 1) _mindex = mesh._mates._children._index(<void*> material) @@ -74,10 +73,7 @@ self._list._arraySize = self._list._arraySize + 1 self._list._flagUpdated(self._index, self._list._arraySize-self._index) # - ##mesh._mates._children.unlock() - ##self._list._children.unlock() - mesh._mates._children._stepUnlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) self.verts = verts @@ -96,13 +92,11 @@ cdef object t cdef soy._datatypes.VertexList _verts _verts = (<soy.meshes.Mesh> self._list._mesh)._verts - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) t = (_verts[self._list._array[self._index].a], _verts[self._list._array[self._index].b], _verts[self._list._array[self._index].c]) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) return t def __set__(self, value) : cdef int i @@ -113,14 +107,12 @@ for i from 0 <= i < 3 : if type(value[i]) != Vertex : raise TypeError('All three elements must be of type Vertex') - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) self._list._array[self._index].a = (<Vertex> value[0])._index self._list._array[self._index].b = (<Vertex> value[1])._index self._list._array[self._index].c = (<Vertex> value[2])._index self._list._flagUpdated(self._index, 1) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) property material : @@ -130,19 +122,13 @@ cdef soy._datatypes.MaterialList mlist cdef soy._datatypes.Face _face mlist = (<soy.meshes.Mesh> self._list._mesh)._mates - ##self._list._children.lock() - ##mlist._children.lock() - self._list._children._stepLock() - mlist._children.stepLock() + py.PyThread_acquire_lock(self._mutex, 1) for i from 0 <= i < mlist._children._current : if self._index >= mlist._ranges[i].offset and \ self._index < mlist._ranges[i].offset + mlist._ranges[i].length : material = <soy.materials.Material> mlist._children._list[i] break - ##self._list._children.unlock() - ##mlist._children.unlock() - self._list._children._stepUnlock() - mlist._children._stepUnlock() + py.PyThread_release_lock(self._mutex) if material : return material else : @@ -152,10 +138,7 @@ cdef soy._datatypes.Face _face cdef soy._datatypes.MaterialList mlist mlist = (<soy.meshes.Mesh> self._list._mesh)._mates - ##self._list._children.lock() - ##mlist._children.lock() - self._list._children._stepLock() - mlist._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) _mindex = -1 _oldindex = self._index _face = self._list._array[self._index] @@ -165,10 +148,7 @@ _mindex = i break if _mindex == -1 : - ##self._list._children.unlock() - ##mlist._children.unlock() - self._list._children._stepUnlock() - mlist._children._stepUnlock() + py.PyThread_release_lock(self._mutex) raise RuntimeError('This error should never happen. ' + \ 'Please file a ticket on www.pysoy.org') # @@ -228,7 +208,4 @@ self._list._array[i+1] = self._list._array[i] self._list._array[self._index] = _face self._list._flagUpdated(self._index, _oldindex - self._index + 1) - ##self._list._children.unlock() - ##mlist._children.unlock() - self._list._children._stepUnlock() - mlist._children._stepUnlock() + py.PyThread_release_lock(self._mutex) Modified: trunk/pysoy/src/atoms/Vertex.pxi =================================================================== --- trunk/pysoy/src/atoms/Vertex.pxi 2008-03-06 17:52:49 UTC (rev 1065) +++ trunk/pysoy/src/atoms/Vertex.pxi 2008-03-06 18:18:27 UTC (rev 1066) @@ -72,13 +72,11 @@ def __get__(self) : cdef float x, y, z cdef object t - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) t = (self._list._array[self._index].px, self._list._array[self._index].py, self._list._array[self._index].pz) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) return t def __set__(self, value) : cdef int i @@ -101,65 +99,55 @@ def __get__(self) : cdef float x, y, z cdef object t - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) t = (self._list._array[self._index].nx, self._list._array[self._index].ny, self._list._array[self._index].nz) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) return t def __set__(self, value) : if type(value)!=tuple and type(value)!=list : raise TypeError('Must provide a tuple or list') if len(value)!=3 : raise TypeError('Must provide (x,y,z)') - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) self._list._array[self._index].nx = value[0] self._list._array[self._index].ny = value[1] self._list._array[self._index].nz = value[2] self._list._flagUpdated(self._index) - #self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) property texcoord : def __get__(self) : cdef float x, y, z cdef object t - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) t = (self._list._array[self._index].tx, self._list._array[self._index].ty, self._list._array[self._index].tz) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) return t def __set__(self, value) : if type(value)!=tuple and type(value)!=list : raise TypeError('Must provide a tuple or list') if len(value)!=3 : raise TypeError('Must provide (x,y,z)') - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) self._list._array[self._index].tx = value[0] self._list._array[self._index].ty = value[1] self._list._array[self._index].tz = value[2] self._list._flagUpdated(self._index) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) property tangent: def __get__(self): cdef object t - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) t = (self._list._array[self._index].tan_x, self._list._array[self._index].tan_y, self._list._array[self._index].tan_z) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) return t def __set__(self,value): if type(value)!=tuple and type(value)!=list : @@ -167,21 +155,10 @@ if len(value)!=3 : raise TypeError('Must provide (x,y,z)') - ##self._list._children.lock() - self._list._children._stepLock() + py.PyThread_acquire_lock(self._mutex, 1) self._list._array[self._index].tan_x = value[0] self._list._array[self._index].tan_y = value[1] self._list._array[self._index].tan_z = value[2] self._list._flagUpdated(self._index) - ##self._list._children.unlock() - self._list._children._stepUnlock() + py.PyThread_release_lock(self._mutex) -# DIRTY! 38-46 -# DIRTY! 72-76 -# DIRTY! 87-92 -# DIRTY! 99-103 -# DIRTY! 110-115 -# DIRTY! 122-126 -# DIRTY! 133-138 -# DIRTY! 143-147 -# DIRTY! 155-160 _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn