Hey all,

I have this concept I'm working on and here is
the code... Problem is if you run this it doesn't
terminate. I believe you can terminate it in the
main process by calling a.stop() But I can't find a
way for it to self terminate, ie: self.stop() As indicated
by the code...
I'm not sure what you wanted to do here, but it is for sure that your "running" variable is not shared between the processes. Use this instead:

from multiprocessing import Value
self.running = Value('i',0)

Then these:

self.running.value = 1
self.running.value = 0
if self.running.value:

But I'm affraid your example won't work. Considering your stop() method:

   def stop(self):
       print "%s: Stopping ..." % self
       self.running.value = 0

It would set running.value to zero. However, at that time there will be other processes running their start() method and setting the same shared value to 1.

What do you want to try with this example?

 L

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to