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.<br><br>Concurrently fetching from different caches can indeed run their separate fallbacks concurrently.<br>
<br><div>On Fri, Jun 13, 2014, 10:16 AM, Peter Simons <<a href="mailto:simons@cryp.to">simons@cryp.to</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Dan,<br>
<br>
 > 1. Create an empty cache with newCache<br>
 > 2. fetch repeatedly from the cache, each time providing a fallback in<br>
 >    case it is empty.<br>
 ><br>
 > Fetching from a Cache is thread safe: only one "fallback" will execute<br>
 > at a time, and after the first successful fallback, the cached value<br>
 > will be set and no other fallbacks will be called.<br>
<br>
I'm not sure whether I get this correctly. If multiple threads fetch<br>
values from one cache, will only one of those threads run at a time? Or<br>
will those that fetch pairwise different values still run concurrently?<br>
<br>
In other words, does the cache have a global lock or is there a lock per<br>
value?<br>
<br>
Best regards,<br>
Peter<br>
<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote>