Skip to content

Commit

Permalink
README.rst: Trim outdated .EXCLUSIVE snippets
Browse files Browse the repository at this point in the history
It looks like these sections got duplicated somehow. I've kept only the portalocker.LOCK_EX snippet, since it seems to be the only valid flag presently.
  • Loading branch information
joshuacwnewton committed Feb 16, 2022
1 parent b47d5f4 commit f5823f8
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions README.rst
Expand Up @@ -121,38 +121,6 @@ To make sure your cache generation scripts don't race, use the `Lock` class:

To customize the opening and locking a manual approach is also possible:

>>> import portalocker
>>> file = open('somefile', 'r+')
>>> portalocker.lock(file, portalocker.EXCLUSIVE)
>>> file.seek(12)
>>> file.write('foo')
>>> file.close()

Explicitly unlocking is not needed in most cases but omitting it has been known
to cause issues:

>>> import portalocker
>>> with portalocker.Lock('somefile', timeout=1) as fh:
... print >>fh, 'writing some stuff to my cache...'

To customize the opening and locking a manual approach is also possible:

>>> import portalocker
>>> file = open('somefile', 'r+')
>>> portalocker.lock(file, portalocker.EXCLUSIVE)
>>> file.seek(12)
>>> file.write('foo')
>>> file.close()

Explicitly unlocking is not needed in most cases but omitting it has been known
to cause issues:

>>> import portalocker
>>> with portalocker.Lock('somefile', timeout=1) as fh:
... print >>fh, 'writing some stuff to my cache...'

To customize the opening and locking a manual approach is also possible:

>>> import portalocker
>>> file = open('somefile', 'r+')
>>> portalocker.lock(file, portalocker.LOCK_EX)
Expand Down

0 comments on commit f5823f8

Please sign in to comment.