I guess I should be more specific about what I'm trying to do.
I have a process spawner, which runs A* path finding in a new process.
(warning for pseudo code)
def search(start, end):
proc = Worker(que, start, end)
proc.start()
class Worker:
def run(self):
# do the expensive search
if path is found:
self.que.put(path)
In the main program I have a thread waiting for paths:
class Receive(Thread):
def run(self, que):
while True:
path = self.que.get()
if path:
system.dispatch_event('display_path', path)
This crashes the program, resulting in the error I mentioned.
I can work around it, using this kind of trick:
class Receive(Thread):
def run(self, que):
while True:
path = self.que.get()
if path:
system.path = path
class World(cocos.layer.Layer):
def __init__(self):
self.schedule_interval(self.check, 1/60.)
def check(self):
if not self.system.path is None:
self.display_path(self.system.path)
However, this is undesirable, and I want to solve this with just using
the former receive thread, calling system.dispatch_event directly.
How can I do event dispatching from the Receive thread directly? Or
else, how can I do it in any other way than schedule_interval?
On 06.11.2013 08:08, Paul Pittlerson wrote:
I'm trying to combine pyglet (cocos2d) with threading and multiprocessing
to make the game responsive even during expensive pathfinding searches.
However, I get this rather long error message: http://pastebin.com/ySvarUFt
...
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/lib.py", line 105,
inerrcheck
raise GLException(msg)
pyglet.gl.lib.GLException: invalid operation
I searched for threading here in the pyglet list, and found a post with a
mention of overriding pyglet.app.EventLoop.idle().
https://groups.google.com/forum/#!searchin/pyglet-users/thread/pyglet-users/X3nZG7JeP9o/k7Keiy-XzN4J
Can someone give me a more detailed description of what I have to do
exactly to get it working? Thanks!
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.