Commit 5c5a15c9 authored by Andrew Svetlov's avatar Andrew Svetlov

Use try-finally idiom in example for locks in multiprocessing

parent d4248d3c
......@@ -262,7 +262,9 @@ that only one process prints to standard output at a time::
def f(l, i):
l.acquire()
try:
print('hello world', i)
finally:
l.release()
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment