On Mon, Sep 21, 2009 at 2:38 PM, Arun Sharma <[email protected]> wrote:
> The wait vs sleep behavior of the cache currently depends
> on HAVE_ATOMIC_OPS, which is more of an implementation detail and therefore
> shouldn't affect the behavior of the API. I don't mind having
> CONFIG_CACHE_WAIT=1 unconditionally (without a config option).
> If you're a libunwind user and would like the "return NULL" behavior when
> there is contention on the cache, please speak up.
Attached patch makes this change unconditional.
Thanks,
--
Paul Pluzhnikov
diff --git a/include/dwarf.h b/include/dwarf.h
index c7c757e..37b5ec1 100644
--- a/include/dwarf.h
+++ b/include/dwarf.h
@@ -312,11 +312,7 @@ typedef unsigned char unw_hash_index_t;
struct dwarf_rs_cache
{
-#ifdef HAVE_ATOMIC_OPS_H
- AO_TS_t busy; /* is the rs-cache busy? */
-#else
pthread_mutex_t lock;
-#endif
unsigned short lru_head; /* index of lead-recently used rs */
unsigned short lru_tail; /* index of most-recently used rs */
diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c
index 3969cb3..1e37b5b 100644
--- a/src/dwarf/Gparser.c
+++ b/src/dwarf/Gparser.c
@@ -481,21 +481,11 @@ get_rs_cache (unw_addr_space_t as, intrmask_t
*saved_maskp)
if (caching == UNW_CACHE_NONE)
return NULL;
-#ifdef HAVE_ATOMIC_H
- if (!spin_trylock_irqsave (&cache->busy, *saved_maskp))
- return NULL;
-#else
-# ifdef HAVE_ATOMIC_OPS_H
- if (AO_test_and_set (&cache->busy) == AO_TS_SET)
- return NULL;
-# else
if (likely (caching == UNW_CACHE_GLOBAL))
{
Debug (16, "%s: acquiring lock\n", __FUNCTION__);
lock_acquire (&cache->lock, *saved_maskp);
}
-# endif
-#endif
if (atomic_read (&as->cache_generation) != atomic_read (&cache->generation))
{
@@ -513,16 +503,8 @@ put_rs_cache (unw_addr_space_t as, struct dwarf_rs_cache
*cache,
assert (as->caching_policy != UNW_CACHE_NONE);
Debug (16, "unmasking signals/interrupts and releasing lock\n");
-#ifdef HAVE_ATOMIC_H
- spin_unlock_irqrestore (&cache->busy, *saved_maskp);
-#else
-# ifdef HAVE_ATOMIC_OPS_H
- AO_CLEAR (&cache->busy);
-# else
if (likely (as->caching_policy == UNW_CACHE_GLOBAL))
lock_release (&cache->lock, *saved_maskp);
-# endif
-#endif
}
static inline unw_hash_index_t
_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel