From 9752c321b4b291979312c9064e9e0cde6d68689e Mon Sep 17 00:00:00 2001 From: Antoine Millet Date: Mon, 31 Jan 2011 16:27:04 +0100 Subject: [PATCH] Added "with" statement feature to the BytesBuffer (used to lock the buffer). --- sjrpc/utils/datastructures.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sjrpc/utils/datastructures.py b/sjrpc/utils/datastructures.py index 2f62e34..d2fbcd2 100644 --- a/sjrpc/utils/datastructures.py +++ b/sjrpc/utils/datastructures.py @@ -63,3 +63,9 @@ class BytesBuffer(object): ''' return len(self._buf) + + def __enter__(self): + return self._lock.__enter__() + + def __exit__(self): + return self._lock.__exit__() -- GitLab