[Orbit-python-list] Orbit-python and threading?
Status: Inactive
Brought to you by:
tack
From: Marijn V. <ma...@me...> - 2001-11-07 20:28:24
|
Dear listers, I am trying to get some program to work with python-orbit. Because I need it to do some more work besides just waiting for corba requests to come in, and i didn't see any "idle" hooks (ala gtk.py), My solution is to dump the Orbit run() in it's own thread, while the rest of the processing goes on in the mainthread.=20 Anyway, a strange thing happens, when I do that orb.run() the application blocks (surprise!) nomatter that it's running in it's own thread. If I replace the orb.run() with something like time.sleep(largenumber) the threading works as expected. I don't really know what the cause of this is, or what to do about it. Any help would be greatly apriciated. What am I doing that i shouldn't? And if i can't mix orb.run() with threads, how do i do some processing while orb.run() is just blocking waiting for requests?=20 I included the most relevant source snippit, maybe i am doing something very wrong, somehow... Regrads, Marijn. =20 --- Here's the code that does the threading: "sim" and "user" are two objects that hold the data the server has to work with and "lock" is a global lock so that the implementation class won't read/write to the data structures when an update of that data is going on. import CORBA, SimServer, SimServer__POA from threading import * import time class SimServer: def __init__(self, sim, user, lock): self._thread =3D Thread(target=3Dself.run, name=3D"Orbit") argv =3D [] argv.append('ORBIIOPIPv4=3D1') self.orb =3D CORBA.ORB_init(argv) self.poa =3D self.orb.resolve_initial_references("RootPOA") ref =3D SimServer_Sim_Impl(sim, user, lock)._this() open("server.ior", "w").write(self.orb.object_to_string(ref)) self.poa.the_POAManager.activate() # self._thread.setDaemon(1) print "pre thread start" self._thread.start() print "post thread start" def run(self): print "orb run" print enumerate() # time.sleep(500) self.orb.run() print "orb end" --=20 Get loaded from the source: Do Linux! Marijn Vriens <ma...@me...>=20 GPG/PGP: 6895 DF03 73E1 F671 C61D 45F4 5E83 8571 C529 5C15 |