Author: ArcRiley Date: 2008-02-19 11:38:40 -0500 (Tue, 19 Feb 2008) New Revision: 948
Modified: trunk/pysoy/src/_internals/LoopThread.pxi trunk/pysoy/src/_internals/soy._internals.pxd Log: #932 : will now wake from extended sleep when new child is added Modified: trunk/pysoy/src/_internals/LoopThread.pxi =================================================================== --- trunk/pysoy/src/_internals/LoopThread.pxi 2008-02-19 16:16:33 UTC (rev 947) +++ trunk/pysoy/src/_internals/LoopThread.pxi 2008-02-19 16:38:40 UTC (rev 948) @@ -73,25 +73,24 @@ def setDaemon(self, daemonic) : assert False, "cannot set daemon status of LoopThread" - - def run(self) : - with nogil : - self._loop() - cdef void _loop(self) : cdef int _i, _t, _most # py.PyThread_acquire_lock(self._loopLock, 1) while self._running : py.PyThread_acquire_lock(self._listLock, 1) - _most = 10 + _most = 600000 + self._wake = 0 for _i from 0 <= _i < self._current : _t = (<Loopable> self._list[_i])._loop() if _t < _most : _most = _t py.PyThread_release_lock(self._listLock) - _sleep(_most) + for _i from 0 <= _i < _most : + if self._wake : + break + _sleep(1) py.PyThread_release_lock(self._loopLock) stdio.printf('Finished C\n') @@ -102,6 +101,7 @@ self._list = <void **> py.PyMem_Realloc(self._list, sizeof(void*) * (self._size)) self._list[self._current] = _child self._current = self._current + 1 + self._wake = 1 py.PyThread_release_lock(self._listLock) cdef void _remove(self, void* _child) : @@ -113,4 +113,5 @@ self._list[_j] = self._list[_j + 1] self._current = self._current - 1 break + self._wake = 1 py.PyThread_release_lock(self._listLock) Modified: trunk/pysoy/src/_internals/soy._internals.pxd =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pxd 2008-02-19 16:16:33 UTC (rev 947) +++ trunk/pysoy/src/_internals/soy._internals.pxd 2008-02-19 16:38:40 UTC (rev 948) @@ -57,6 +57,7 @@ cdef int _size cdef int _current cdef int _running + cdef int _wake cdef void** _list cdef void * _listLock cdef void * _loopLock _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn