<[EMAIL PROTECTED]> wrote: > I have inheirted some existing code, that i will explain in a moment, > have needed to extend and ultimately should be able to run in threads. > I've done a bunch of work with python but very little with threads and > am looking for some pointers on how to implement, and if the lower > level modules/objects need to be rewritten to use threading.local for > all local variables. > > I have a module that communicates with a hardware device, which reads > data off of sensors, that can only talk with one controller at a time. > The controller (my module) needs to (in its simplest form) init, > configure the device, request data, and write out xml, sleep, repeat. > > The new request is that the device needs to be queried until a > condition is true, and then start requesting data. So an instance of a > controller needs to be deadicated to a hardware device forever, or > until the program ends....which ever comes first. > > This currently works in a non-threaded version, but only for one device > at a time, there is a need to create a single windows(yeach) service > that talks to many of these devices at once. I don't need worker > threads that handle seperate portions of the entire job, i need a > single application to spawn multiple processes to run through the > entire communication from configure to report, sleep until the next > interval time and run again. The communication could last from 1 > minute to 10 minutes before it ends.
8<------------------------------------------------------------------------------ not sure if I understand this correctly - but I would in this position spawn new threads, and use a global list of queues to interface between the new threads and the old comms module, still talking to one device at a time, but now time sliced. - in the comms module: for q in list_of_queues: see if anything to ask: continue if not ask it and put answer on reply queue but then I am a Philistine coder, interested only in getting the job done... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list