Merge pull request #14 from ubershmekel/patch-2

Added a code sample
This commit is contained in:
Joshua Harlow
2016-01-04 21:40:42 -08:00

View File

@@ -17,3 +17,18 @@ Decorators
----------
.. autofunction:: fasteners.process_lock.interprocess_locked
.. code-block:: python
# Launch multiple of these at the same time to see the lock in action
import time
import fasteners
@fasteners.process_lock.interprocess_locked('tmp_lock_file')
def test():
for i in range(10):
print('I have the lock')
time.sleep(1)
print('Waiting for the lock')
test()