- put up EOL

This commit is contained in:
Mike Bayer 2016-05-30 16:45:44 -04:00
parent e9011d8495
commit 661aac8411
3 changed files with 26 additions and 7 deletions

View File

@ -1,6 +1,11 @@
dogpile.core
============
.. note::
The dogpile.core package has been rolled into dogpile.cache directly.
dogpile.core as a separate package is effectively EOL.
A "dogpile" lock, one which allows a single thread to generate
an expensive resource while other threads use the "old" value, until the
"new" value is ready.
@ -15,7 +20,7 @@ A simple example::
from dogpile.core import Dogpile
# store a reference to a "resource", some
# store a reference to a "resource", some
# object that is expensive to create.
the_resource = [None]
@ -38,13 +43,13 @@ A simple example::
use_the_resource()
Above, ``some_creation_function()`` will be called
when ``Dogpile.acquire()`` is first called. The
remainder of the ``with`` block then proceeds. Concurrent threads which
when ``Dogpile.acquire()`` is first called. The
remainder of the ``with`` block then proceeds. Concurrent threads which
call ``Dogpile.acquire()`` during this initial period
will be blocked until ``some_creation_function()`` completes.
Once the creation function has completed successfully the first time,
new calls to ``Dogpile.acquire()`` will call ``some_creation_function()``
new calls to ``Dogpile.acquire()`` will call ``some_creation_function()``
each time the "expiretime" has been reached, allowing only a single
thread to call the function. Concurrent threads
which call ``Dogpile.acquire()`` during this period will
@ -60,8 +65,8 @@ Development Status
dogpile.core has been in use in a small number of production environments for a period of
months, and as of 0.3.2 has entered beta status. No issues have been reported yet with its
core synchronization model, and overall the project hasn't seen many changes.
Most development continues within dogpile.cache.
core synchronization model, and overall the project hasn't seen many changes.
Most development continues within dogpile.cache.

View File

@ -2,6 +2,12 @@
Welcome to dogpile.core's documentation!
========================================
.. note::
The dogpile.core package has been rolled into dogpile.cache directly as
of version 0.6.0 of dogpile.cache. dogpile.core as a separate package is
effectively EOL.
`dogpile.core <http://bitbucket.org/zzzeek/dogpile>`_ provides the *dogpile* lock,
one which allows a single thread or process to generate
an expensive resource while other threads/processes use the "old" value, until the

View File

@ -127,6 +127,7 @@ class Lock(object):
log.debug("no value, waiting for create lock")
self.mutex.acquire()
value = NO_VALUE = object()
try:
log.debug("value creation lock %r acquired" % self.mutex)
@ -150,7 +151,14 @@ class Lock(object):
return created
finally:
if not async:
self.mutex.release()
try:
self.mutex.release()
except:
if self.only_warn_on_release_failure \
and value is not NO_VALUE:
raise LockReleaseFailure(value)
else:
raise
log.debug("Released creation lock")