Author: ArcRiley
Date: 2008-02-10 04:59:01 -0500 (Sun, 10 Feb 2008)
New Revision: 844

Added:
   trunk/pysoy/src/_core-common/_eventLoop.pxi
Removed:
   trunk/pysoy/scripts/_eventloop.py
Modified:
   trunk/pysoy/scripts/__init__.py
   trunk/pysoy/src/_core-common/_init.pxi
Log:
first step toward a more efficient EventLoop


Modified: trunk/pysoy/scripts/__init__.py
===================================================================
--- trunk/pysoy/scripts/__init__.py     2008-02-09 10:54:17 UTC (rev 843)
+++ trunk/pysoy/scripts/__init__.py     2008-02-10 09:59:01 UTC (rev 844)
@@ -19,9 +19,8 @@
 
 from _core import Screen, Window, \
                   __author__, __credits__, __date__, __doc__, __version__
-import _datatypes
-import _eventloop
 import _internals
+import _datatypes
 import actions
 import atoms
 import bodies
@@ -35,5 +34,3 @@
 import textures
 import transports
 import widgets
-
-_eventloop.EventLoop().start()

Deleted: trunk/pysoy/scripts/_eventloop.py
===================================================================
--- trunk/pysoy/scripts/_eventloop.py   2008-02-09 10:54:17 UTC (rev 843)
+++ trunk/pysoy/scripts/_eventloop.py   2008-02-10 09:59:01 UTC (rev 844)
@@ -1,33 +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$
-
-import os
-import threading
-from _internals import get_queue
-
-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) :
-    queue = get_queue()
-    while 1 :
-      cb = queue.pop()
-      cb()

Copied: trunk/pysoy/src/_core-common/_eventLoop.pxi (from rev 843, 
trunk/pysoy/scripts/_eventloop.py)
===================================================================
--- trunk/pysoy/src/_core-common/_eventLoop.pxi                         (rev 0)
+++ trunk/pysoy/src/_core-common/_eventLoop.pxi 2008-02-10 09:59:01 UTC (rev 
844)
@@ -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()

Modified: trunk/pysoy/src/_core-common/_init.pxi
===================================================================
--- trunk/pysoy/src/_core-common/_init.pxi      2008-02-09 10:54:17 UTC (rev 
843)
+++ trunk/pysoy/src/_core-common/_init.pxi      2008-02-10 09:59:01 UTC (rev 
844)
@@ -19,21 +19,21 @@
 
 cdef void _init() :
   cdef int threadid, eventthread
-
+  #
   # Install quit signal catcher
   import signal
   signal.signal(signal.SIGTERM, quit)
-
+  #
   # Initialize Core Libraries 
   py.PyThread_init_thread()
   ode.dInitODE()
-
+  #
   # Launch CoreLoop Thread 
   threadid = 1
   launched = py.PyThread_start_new_thread( <void ((*)(void (*)))> _coreLoop, \
                                            <void *> &threadid )
+  #
+  # Launch EventLoop Thread (via Python API)
+  _EventLoop().start()
 
-  #eventthread = 2
-  #launched = py.PyThread_start_new_thread( <void ((*)(void (*)))> _eventLoop, 
\
-  #                                       <void *> &eventthread )
 _init()

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to