[Haskell-cafe] ANN: io-memoize 1.1
Dan Burton
danburton.email at gmail.com
Fri Jun 13 17:43:04 UTC 2014
Sorry I wasn't clear about that. The lock is not global, it is per cache.
newCache creates a newMVar which serves as the thread safe lock for that
cache.
Concurrently fetching from different caches can indeed run their separate
fallbacks concurrently.
On Fri, Jun 13, 2014, 10:16 AM, Peter Simons <simons at cryp.to> wrote:
> Hi Dan,
>
> > 1. Create an empty cache with newCache
> > 2. fetch repeatedly from the cache, each time providing a fallback in
> > case it is empty.
> >
> > Fetching from a Cache is thread safe: only one "fallback" will execute
> > at a time, and after the first successful fallback, the cached value
> > will be set and no other fallbacks will be called.
>
> I'm not sure whether I get this correctly. If multiple threads fetch
> values from one cache, will only one of those threads run at a time? Or
> will those that fetch pairwise different values still run concurrently?
>
> In other words, does the cache have a global lock or is there a lock per
> value?
>
> Best regards,
> Peter
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140613/af678fbf/attachment.html>
More information about the Haskell-Cafe
mailing list