[Zope] threading problems in zope

sameer chaudhry sameer_@email.com
Wed, 05 Feb 2003 08:33:57 -0500


I am at my wits end trying to figure this problem out as it works only in python but doesn't work in zope.  Basically, I have a product that starts of a new thread in the init method which performs a long computation and when it's done it updates a value in the main thread.  The thread is supposed to run forever as it's in a while loop that sleeps and runs the computation, yet the computation is only performed once.  Can anyone shed some light on whether there are problems using Zope with our own threads?  I did look at ZODB code, but it didn't help.  Following is the relevant code of my product.  Let me know why the thread only runs once and not forever.  Thanks.

class ServerManager(SimpleItem):
  "AServerManagerClass"
  meta_type = "ServerManager"

  def __init__(self, id):
    self.id = id
    self.status_dict = {}
    update_thread = threading.Thread(target=self.update_values)
    update_thread.setDaemon(1)
    update_thread.start()
    self.__changed__(1)

  def view_status(self, REQUEST):
    "returns status"
    return self.status_dict 

  def update_values(self):
    while(1):
      result = main_result() #some external method
      self.status_dict = result
      self.__changed__(1)
      time.sleep(100)



-- 
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Meet Singles
http://corp.mail.com/lavalife