diff options
| author | Gordon Sim <gsim@apache.org> | 2007-01-18 11:29:31 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-01-18 11:29:31 +0000 |
| commit | c6010ef8f904c157a375189155dc0694d7d0be74 (patch) | |
| tree | f717fa1f49f2053be3992d83c3a1832c76224794 /qpid/python | |
| parent | db41968325bc24b6d91656afdd36b49c9e5ecda7 (diff) | |
| download | qpid-python-c6010ef8f904c157a375189155dc0694d7d0be74.tar.gz | |
Locked Channel::close() due to race.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@497404 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/qpid/peer.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/qpid/python/qpid/peer.py b/qpid/python/qpid/peer.py index a265e45f43..ef913d6196 100644 --- a/qpid/python/qpid/peer.py +++ b/qpid/python/qpid/peer.py @@ -127,16 +127,22 @@ class Channel: self.queue = None self.closed = False self.reason = None + #lock used to synchronise calls to close + self.lock = thread.allocate_lock() def close(self, reason): - if isinstance(reason, Message): + self.lock.acquire() + try: + if isinstance(reason, Message): + self.reason = reason + if self.closed: + return + self.closed = True self.reason = reason - if self.closed: - return - self.closed = True - self.reason = reason - self.incoming.close() - self.responses.close() + self.incoming.close() + self.responses.close() + finally: + self.lock.release() def dispatch(self, frame, work): payload = frame.payload |
