Author: ArcRiley Date: 2008-02-10 05:01:38 -0500 (Sun, 10 Feb 2008) New Revision: 845
Added: trunk/pysoy/src/_core-common/_EventLoop.pxi trunk/pysoy/src/_internals/_getQueue.pxi Removed: trunk/pysoy/src/_core-common/_eventLoop.pxi trunk/pysoy/src/_internals/_get_queue.pxi Modified: trunk/pysoy/src/_core-w32/soy._core.pyx trunk/pysoy/src/_core-x11/soy._core.pyx trunk/pysoy/src/_internals/AsyncQueue.pxi trunk/pysoy/src/_internals/soy._internals.pyx trunk/pysoy/src/actions/Callback.pxi Log: A few more steps closer Copied: trunk/pysoy/src/_core-common/_EventLoop.pxi (from rev 844, trunk/pysoy/src/_core-common/_eventLoop.pxi) =================================================================== --- trunk/pysoy/src/_core-common/_EventLoop.pxi (rev 0) +++ trunk/pysoy/src/_core-common/_EventLoop.pxi 2008-02-10 10:01:38 UTC (rev 845) @@ -0,0 +1,31 @@ +# PySoy callback event loop +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +class _EventLoop(threading.Thread) : + def __init__(self, group=None, target=None, name=None, + args=(), kwargs=None, verbose=None): + threading.Thread.__init__(self, name="EventLoop") + self.setDaemon(True) + def run(self) : + cdef object _callback + cdef soy._internals.AsyncQueue _queue + _queue = soy._internals._getQueue() + while 1 : + _callback = _queue._pop() + _callback() Deleted: trunk/pysoy/src/_core-common/_eventLoop.pxi =================================================================== --- trunk/pysoy/src/_core-common/_eventLoop.pxi 2008-02-10 09:59:01 UTC (rev 844) +++ trunk/pysoy/src/_core-common/_eventLoop.pxi 2008-02-10 10:01:38 UTC (rev 845) @@ -1,31 +0,0 @@ -# PySoy callback event loop -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -class _EventLoop(threading.Thread) : - def __init__(self, group=None, target=None, name=None, - args=(), kwargs=None, verbose=None): - threading.Thread.__init__(self, name="EventLoop") - self.setDaemon(True) - def run(self) : - cdef object _callback - cdef soy._internals.AsyncQueue _queue - _queue = soy._internals._getQueue() - while 1 : - _callback = _queue._pop() - _callback() Modified: trunk/pysoy/src/_core-w32/soy._core.pyx =================================================================== --- trunk/pysoy/src/_core-w32/soy._core.pyx 2008-02-10 09:59:01 UTC (rev 844) +++ trunk/pysoy/src/_core-w32/soy._core.pyx 2008-02-10 10:01:38 UTC (rev 845) @@ -42,6 +42,7 @@ include "../_core-common/quit.pxi" include "../_core-common/_callback.pxi" include "../_core-common/_coreLoop.pxi" +include "../_core-common/_EventLoop.pxi" include "../_core-common/_runField.pxi" include "../_core-common/_prerunField.pxi" include "../_core-common/_init.pxi" Modified: trunk/pysoy/src/_core-x11/soy._core.pyx =================================================================== --- trunk/pysoy/src/_core-x11/soy._core.pyx 2008-02-10 09:59:01 UTC (rev 844) +++ trunk/pysoy/src/_core-x11/soy._core.pyx 2008-02-10 10:01:38 UTC (rev 845) @@ -25,8 +25,10 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' +import threading cimport stdlib +import soy.colors cimport soy.joints cimport soy.bodies.fields cimport soy.bodies._bodies @@ -35,7 +37,6 @@ cimport soy.textures cimport soy.transports cimport soy.widgets -import soy.colors include "../_core-common/_Transports.pxi" include "Screen.pxi" @@ -45,6 +46,7 @@ include "../_core-common/quit.pxi" include "../_core-common/_callback.pxi" include "../_core-common/_coreLoop.pxi" +include "../_core-common/_EventLoop.pxi" include "../_core-common/_runField.pxi" include "../_core-common/_prerunField.pxi" include "../_core-common/_init.pxi" Modified: trunk/pysoy/src/_internals/AsyncQueue.pxi =================================================================== --- trunk/pysoy/src/_internals/AsyncQueue.pxi 2008-02-10 09:59:01 UTC (rev 844) +++ trunk/pysoy/src/_internals/AsyncQueue.pxi 2008-02-10 10:01:38 UTC (rev 845) @@ -34,12 +34,9 @@ cdef void _push(self, void* data) : glib.g_async_queue_push(self._asyncqueue, data) - cdef void* _pop(self) : + cdef object _pop(self) : + cdef object _obj with nogil: - return glib.g_async_queue_pop(self._asyncqueue) - - def pop(self): - cdef object obj - obj = <object>self._pop() - py.Py_DECREF(obj) - return obj + _obj = <object> glib.g_async_queue_pop(self._asyncqueue) + py.Py_DECREF(_obj) + return _obj Copied: trunk/pysoy/src/_internals/_getQueue.pxi (from rev 843, trunk/pysoy/src/_internals/_get_queue.pxi) =================================================================== --- trunk/pysoy/src/_internals/_getQueue.pxi (rev 0) +++ trunk/pysoy/src/_internals/_getQueue.pxi 2008-02-10 10:01:38 UTC (rev 845) @@ -0,0 +1,26 @@ +# PySoy _internals._get_queue function +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +glib.g_thread_init(<glib.GThreadFunctions*> 0) + +cdef AsyncQueue _queue +_queue = AsyncQueue() + +cdef AsyncQueue _getQueue(): + return _queue Deleted: trunk/pysoy/src/_internals/_get_queue.pxi =================================================================== --- trunk/pysoy/src/_internals/_get_queue.pxi 2008-02-10 09:59:01 UTC (rev 844) +++ trunk/pysoy/src/_internals/_get_queue.pxi 2008-02-10 10:01:38 UTC (rev 845) @@ -1,29 +0,0 @@ -# PySoy _internals._get_queue function -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see http://www.gnu.org/licenses -# -# $Id$ - -glib.g_thread_init(<glib.GThreadFunctions*> 0) - -cdef AsyncQueue _queue -_queue = AsyncQueue() - -cdef AsyncQueue _get_queue(): - return _queue - -def get_queue(): - return <object>_get_queue() Modified: trunk/pysoy/src/_internals/soy._internals.pyx =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pyx 2008-02-10 09:59:01 UTC (rev 844) +++ trunk/pysoy/src/_internals/soy._internals.pyx 2008-02-10 10:01:38 UTC (rev 845) @@ -26,11 +26,12 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' +cimport stdio include "AsyncQueue.pxi" include "Children.pxi" include "Loadable.pxi" include "PointerSet.pxi" -include "_get_queue.pxi" +include "_getQueue.pxi" IF UNAME_SYSNAME == "Windows": cimport windows Modified: trunk/pysoy/src/actions/Callback.pxi =================================================================== --- trunk/pysoy/src/actions/Callback.pxi 2008-02-10 09:59:01 UTC (rev 844) +++ trunk/pysoy/src/actions/Callback.pxi 2008-02-10 10:01:38 UTC (rev 845) @@ -28,7 +28,7 @@ #stdio.printf("Callback._perform\n") py.Py_INCREF(self._callback) #stdio.printf("Callback._perform: Incremented reference count\n") - _queue = soy._internals._get_queue() + _queue = soy._internals._getQueue() #stdio.printf("Callback._perform: Got queue: %p\n", <void *>_queue) _queue._push(<void *>self._callback) #stdio.printf("Callback._perform: Done.\n") _______________________________________________ PySoy-SVN mailing list [email protected] http://www.pysoy.org/mailman/listinfo/pysoy-svn
