diff options
-rw-r--r-- | README.rst | 17 | ||||
-rw-r--r-- | docs/build/index.rst | 6 | ||||
-rw-r--r-- | dogpile/core/dogpile.py | 10 |
3 files changed, 26 insertions, 7 deletions
@@ -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. diff --git a/docs/build/index.rst b/docs/build/index.rst index 2d7ce55..7fd0704 100644 --- a/docs/build/index.rst +++ b/docs/build/index.rst @@ -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 diff --git a/dogpile/core/dogpile.py b/dogpile/core/dogpile.py index 2e3ca0e..4ab52b0 100644 --- a/dogpile/core/dogpile.py +++ b/dogpile/core/dogpile.py @@ -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") |