diff options
Diffstat (limited to 'Lib/multiprocessing/dummy/connection.py')
-rw-r--r-- | Lib/multiprocessing/dummy/connection.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/multiprocessing/dummy/connection.py b/Lib/multiprocessing/dummy/connection.py index af10579..874ec8e 100644 --- a/Lib/multiprocessing/dummy/connection.py +++ b/Lib/multiprocessing/dummy/connection.py @@ -53,6 +53,12 @@ class Listener(object): address = property(lambda self: self._backlog_queue) + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, exc_tb): + self.close() + def Client(address): _in, _out = Queue(), Queue() @@ -85,3 +91,9 @@ class Connection(object): def close(self): pass + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, exc_tb): + self.close() |