Last change
on this file was
3356,
checked in by fenix, 12 years ago
|
Load 2.13.1 into vendor/Products.MailHost?/current.
|
-
Property svn:eol-style set to
native
|
File size:
939 bytes
|
Rev | Line | |
---|
[3356] | 1 | ############################################################################## |
---|
| 2 | # |
---|
| 3 | # Copyright (c) 2002 Zope Foundation and Contributors. |
---|
| 4 | # |
---|
| 5 | # This software is subject to the provisions of the Zope Public License, |
---|
| 6 | # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
---|
| 7 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
---|
| 8 | # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
---|
| 9 | # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
---|
| 10 | # FOR A PARTICULAR PURPOSE. |
---|
| 11 | # |
---|
| 12 | ############################################################################## |
---|
| 13 | """ |
---|
| 14 | Decorator(s) |
---|
| 15 | """ |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | def synchronized(lock): |
---|
| 19 | """ Decorator for method synchronization. """ |
---|
| 20 | |
---|
| 21 | def wrapper(f): |
---|
| 22 | def method(*args, **kw): |
---|
| 23 | lock.acquire() |
---|
| 24 | try: |
---|
| 25 | return f(*args, **kw) |
---|
| 26 | finally: |
---|
| 27 | lock.release() |
---|
| 28 | return method |
---|
| 29 | return wrapper |
---|
Note: See
TracBrowser
for help on using the repository browser.