Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
08dc5a38
Commit
08dc5a38
authored
Aug 19, 2007
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
synchronize thread start/stop methods
parent
1d037663
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+7
-1
lib/python/Products/MailHost/decorator.py
lib/python/Products/MailHost/decorator.py
+30
-0
No files found.
lib/python/Products/MailHost/MailHost.py
View file @
08dc5a38
...
...
@@ -20,6 +20,7 @@ import rfc822
import
time
import
logging
from
cStringIO
import
StringIO
from
threading
import
Lock
import
Acquisition
import
OFS.SimpleItem
...
...
@@ -38,6 +39,7 @@ from zope.sendmail.delivery import DirectMailDelivery, QueuedMailDelivery, \
QueueProcessorThread
from
interfaces
import
IMailHost
from
decorator
import
synchronized
queue_threads
=
{}
# maps MailHost path -> queue processor threada
...
...
@@ -74,8 +76,10 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
smtp_pwd
=
''
smtp_queue
=
False
smtp_queue_directory
=
'/tmp'
lock
=
Lock
()
# timeout=1.0 # unused?
timeout
=
1.0
manage_options
=
(
(
...
...
@@ -187,6 +191,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
self
.
smtp_pwd
or
None
)
@
synchronized
(
lock
)
def
_stopQueueProcessorThread
(
self
):
""" Stop thread for processing the mail queue """
...
...
@@ -200,6 +205,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
del
queue_threads
[
path
]
LOG
.
info
(
'Thread for %s stopped'
%
path
)
@
synchronized
(
lock
)
def
_startQueueProcessorThread
(
self
):
""" Start thread for processing the mail queue """
...
...
lib/python/Products/MailHost/decorator.py
0 → 100644
View file @
08dc5a38
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
Decorator(s)
$Id: MailHost.py 78992 2007-08-19 11:58:08Z andreasjung $
"""
def
synchronized
(
lock
):
""" Decorator for method synchronization. """
def
wrapper
(
f
):
def
method
(
*
args
,
**
kw
):
lock
.
acquire
()
try
:
return
f
(
*
args
,
**
kw
)
finally
:
lock
.
release
()
return
method
return
wrapper
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment