Skip to content

Commit

Permalink
Bump to 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Sep 20, 2015
1 parent 723c112 commit f693203
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Changes
0.4.0 (2015-09-20)
^^^^^^^^^^^^^^^^^^

* Support Python 3.5
* Support Python 3.5 and `async with` statement

* rename `.reader_lock` -> `.reader`, `.writer_lock` ->
`.writer`. Backward compatibility is preserved.

0.3.0 (2014-02-11)
^^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Requires Python 3.5+
async def go():
rwlock = aiorwlock.RWLock(loop=loop)
async with rwlock.writer_lock:
async with rwlock.writer:
# or same way you can acquire reader lock
# async with rwlock.reader_lock: pass
print("inside writer_lock")
# async with rwlock.reader: pass
print("inside writer")
yield from asyncio.sleep(0.1, loop=loop)
loop.run_until_complete(go())
Expand All @@ -59,10 +59,10 @@ Requires Python 3.3+
@asyncio.coroutine
def go():
rwlock = aiorwlock.RWLock(loop=loop)
with (yield from rwlock.writer_lock):
with (yield from rwlock.writer):
# or same way you can acquire reader lock
# with (yield from rwlock.reader_lock): pass
print("inside writer_lock")
# with (yield from rwlock.reader): pass
print("inside writer")
yield from asyncio.sleep(0.1, loop=loop)
loop.run_until_complete(go())
Expand Down
10 changes: 7 additions & 3 deletions aiorwlock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import collections
import sys

__version__ = '0.3.0'
__version__ = '0.4.0'
__all__ = ['RWLock']

PY_35 = sys.version_info >= (3, 5, 0)
Expand Down Expand Up @@ -245,15 +245,19 @@ def __init__(self, *, fast=False, loop=None):
self._writer_lock = _WriterLock(core)

@property
def reader_lock(self):
def reader(self):
"""The lock used for read, or shared, access"""
return self._reader_lock

reader_lock = reader

@property
def writer_lock(self):
def writer(self):
"""The lock used for write, or exclusive, access"""
return self._writer_lock

writer_lock = writer

def __repr__(self):
return '<RWLock: {} {}>'.format(self.reader_lock.__repr__(),
self.writer_lock.__repr__())

0 comments on commit f693203

Please sign in to comment.