[Zope-dev] Re[2]: moment when zope was started.

Victor Safronovich vsafronovich at naumen.ru
Wed Nov 9 09:06:33 EST 2005


Hello Florent Guillaume,

Wednesday, November 9, 2005, 6:09:29 PM, you wrote:

FG> What do you suggest? If you feel the attribute 'started' should be removed 
FG> from Zope, because it's unused, please file a new ticket in the Zope collector.
   I    think   out,  `Starter`  has  2  Events(  threading.Event  )  startEvent
   and finishEvent, `Starter` manages this events ( sets its flag )

   all others Threads may use this events

   for example (not tested), the code below may be usefull for somebody

   from SomeWhere import Starter as ZopeMainThread
   from threading import Thread

   class MyStartThread(Thread):
      def __init__(self):
          Thread.__init__(self)
          self.setDaemon(1)
      def run(self):
          ZopeMainThread.startEvent.wait()  #  wait  for  start zope, but may be
                                            #  this eat processor resources
          #do_something_at_start
   MyStartThread().start()
   
   class MyFinishThread(Thread):
      def __init__(self):
          Thread.__init__(self)
          self.setDaemon(1)
      def run(self):
          ZopeMainThread.finishEvent.wait() # wait for stop zope
          #do_something_at_finish()
   MyFinishThread().start()
   
-- 
Best regards,
 Victor Safronovich
 NauMen.NauDoc.SoftwareDeveloper  http://www.naumen.ru



More information about the Zope-Dev mailing list