Author: ArcRiley
Date: 2008-03-06 20:24:21 -0500 (Thu, 06 Mar 2008)
New Revision: 1079

Modified:
   trunk/pysoy/src/_internals/Children.pxi
   trunk/pysoy/src/_internals/soy._internals.pxd
Log:
Ticket #901 :
  * changed _iterList to _iterMain for easier readability
  * this commit should change nothing, it's cosmetic only


Modified: trunk/pysoy/src/_internals/Children.pxi
===================================================================
--- trunk/pysoy/src/_internals/Children.pxi     2008-03-07 01:05:15 UTC (rev 
1078)
+++ trunk/pysoy/src/_internals/Children.pxi     2008-03-07 01:24:21 UTC (rev 
1079)
@@ -33,20 +33,20 @@
     self._current  = 0
     self._iters    = 0
     self._list     = <void**> py.PyMem_Malloc(sizeof(void*))
+    self._lockMain = py.PyThread_allocate_lock()
     self._lockIter = py.PyThread_allocate_lock()
-    self._lockList = py.PyThread_allocate_lock()
 
   def __dealloc__(self) :
     py.PyMem_Free(self._list)
+    py.PyThread_free_lock(self._lockMain)
     py.PyThread_free_lock(self._lockIter)
-    py.PyThread_free_lock(self._lockList)
 
   cdef void _iterStart(self) :
-    py.PyThread_acquire_lock(self._lockList, 1)
+    py.PyThread_acquire_lock(self._lockMain, 1)
     py.PyThread_acquire_lock(self._lockIter, 1)
     self._iters = self._iters + 1
     py.PyThread_release_lock(self._lockIter)
-    py.PyThread_release_lock(self._lockList)
+    py.PyThread_release_lock(self._lockMain)
 
 
   cdef void _iterDone(self) :
@@ -56,7 +56,9 @@
   
 
   cdef void _append(self, void* _child) :
-    py.PyThread_acquire_lock(self._lockList, 1)
+    py.PyThread_acquire_lock(self._lockMain, 1)
+    #
+    # Wait until all iterations are complete
     while self._iters != 0 :
       _sleep(1)
     if self._size == self._current :
@@ -65,11 +67,13 @@
                                              sizeof(void*) * (self._size))
     self._list[self._current] = <void*> _child
     self._current = self._current + 1
-    py.PyThread_release_lock(self._lockList)
+    py.PyThread_release_lock(self._lockMain)
 
   cdef void _remove(self, void* _child) :
     cdef int _i, _index
-    py.PyThread_acquire_lock(self._lockList, 1)
+    py.PyThread_acquire_lock(self._lockMain, 1)
+    #
+    # Wait until all iterations are complete
     while self._iters != 0 :
       _sleep(1)
     _index = self._index(_child)
@@ -78,7 +82,7 @@
     for _i from _index <= _i < (self._current - 1) :
       self._list[_i] = self._list[_i + 1]
     self._current = self._current - 1
-    py.PyThread_release_lock(self._lockList)
+    py.PyThread_release_lock(self._lockMain)
 
   cdef int _index(self, void* _child) :
     cdef int _i

Modified: trunk/pysoy/src/_internals/soy._internals.pxd
===================================================================
--- trunk/pysoy/src/_internals/soy._internals.pxd       2008-03-07 01:05:15 UTC 
(rev 1078)
+++ trunk/pysoy/src/_internals/soy._internals.pxd       2008-03-07 01:24:21 UTC 
(rev 1079)
@@ -29,8 +29,8 @@
   cdef int    _current
   cdef int    _iters
   cdef void** _list
+  cdef void*  _lockMain
   cdef void*  _lockIter
-  cdef void*  _lockList
   cdef void   _iterStart ( self )
   cdef void   _iterDone  ( self )
   cdef void   _append    ( self, void* )

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

Reply via email to