Author: ArcRiley
Date: 2008-02-09 05:46:31 -0500 (Sat, 09 Feb 2008)
New Revision: 842
Modified:
trunk/pysoy/scripts/__init__.py
trunk/pysoy/scripts/_eventloop.py
Log:
No longer hangs when main thread closes
Modified: trunk/pysoy/scripts/__init__.py
===================================================================
--- trunk/pysoy/scripts/__init__.py 2008-02-09 05:52:15 UTC (rev 841)
+++ trunk/pysoy/scripts/__init__.py 2008-02-09 10:46:31 UTC (rev 842)
@@ -20,6 +20,7 @@
from _core import Screen, Window, \
__author__, __credits__, __date__, __doc__, __version__
import _datatypes
+import _eventloop
import _internals
import actions
import atoms
@@ -35,6 +36,4 @@
import transports
import widgets
-import _eventloop
_eventloop.EventLoop().start()
-#print "EventLoop started."
Modified: trunk/pysoy/scripts/_eventloop.py
===================================================================
--- trunk/pysoy/scripts/_eventloop.py 2008-02-09 05:52:15 UTC (rev 841)
+++ trunk/pysoy/scripts/_eventloop.py 2008-02-09 10:46:31 UTC (rev 842)
@@ -17,15 +17,24 @@
#
# $Id$
+import os
import threading
from _internals import get_queue
-class EventLoop(threading.Thread):
- def run(self):
- queue = get_queue()
- #print "EventLoop.run(): Have queue, starting loop."
- #print "EventLoop.run(): Queue:", repr(queue)
- while 1:
- cb = queue.pop()
- #print "EventLoop.run(): Got callback:", cb
- cb()
+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()
+ #print "EventLoop.run(): Have queue, starting loop."
+ #print "EventLoop.run(): Queue:", repr(queue)
+ while 1 :
+ cb = queue.pop()
+ #print "EventLoop.run(): Got callback:", cb
+ cb()
+
+ def __stop(self) :
+ # A hack until we get a decent system in place for this
+ threading.Thread.__stop()
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn