[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/mail/ Change the way
QueueProcessorThread handles termination to avoid an empty
Benji York
benji at zope.com
Thu Jan 27 11:32:39 EST 2005
Log message for revision 28965:
Change the way QueueProcessorThread handles termination to avoid an empty
exception on exit provoked by Python 2.3.5c1.
Changed:
U Zope3/trunk/src/zope/app/mail/delivery.py
U Zope3/trunk/src/zope/app/mail/metaconfigure.py
-=-
Modified: Zope3/trunk/src/zope/app/mail/delivery.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/delivery.py 2005-01-27 16:18:42 UTC (rev 28964)
+++ Zope3/trunk/src/zope/app/mail/delivery.py 2005-01-27 16:32:39 UTC (rev 28965)
@@ -22,6 +22,8 @@
import rfc822
import threading
import logging
+import atexit
+import time
from os import unlink, getpid
from cStringIO import StringIO
@@ -125,7 +127,6 @@
def __init__(self):
threading.Thread.__init__(self)
- self.__event = threading.Event()
def setMaildir(self, maildir):
"""Set the maildir.
@@ -167,8 +168,8 @@
return fromaddr, toaddrs, rest
def run(self, forever=True):
-
- while True:
+ atexit.register(self.stop)
+ while not self.__stopped:
for filename in self.maildir:
fromaddr = ''
toaddrs = ()
@@ -195,9 +196,7 @@
filename, exc_info=1)
else:
if forever:
- self.__event.wait(3)
- if self.__stopped:
- return
+ time.sleep(3)
# A testing plug
if not forever:
@@ -205,4 +204,3 @@
def stop(self):
self.__stopped = True
- self.__event.set()
Modified: Zope3/trunk/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/metaconfigure.py 2005-01-27 16:18:42 UTC (rev 28964)
+++ Zope3/trunk/src/zope/app/mail/metaconfigure.py 2005-01-27 16:32:39 UTC (rev 28965)
@@ -54,7 +54,6 @@
thread = QueueProcessorThread()
thread.setMailer(mailerObject)
thread.setQueuePath(queuePath)
- thread.setDaemon(True)
thread.start()
_context.action(
More information about the Zope3-Checkins
mailing list