summaryrefslogtreecommitdiffstats
path: root/sal
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2010-12-26 10:29:06 +0100
committerDavid Tardon <dtardon@redhat.com>2010-12-26 10:29:06 +0100
commit3b34da87b5f2c99120c79cbfbbe8f7da0ff7837a (patch)
treeab5b4b249614abe0888095f658d8d539892ad52c /sal
parentcppcheck: prefer prefix variant (diff)
downloadcore-3b34da87b5f2c99120c79cbfbbe8f7da0ff7837a.tar.gz
core-3b34da87b5f2c99120c79cbfbbe8f7da0ff7837a.zip
avoid data race with wsupdate thread
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/source/alloc_cache.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sal/rtl/source/alloc_cache.c b/sal/rtl/source/alloc_cache.c
index 51e675c39316..01d4e14961f8 100644
--- a/sal/rtl/source/alloc_cache.c
+++ b/sal/rtl/source/alloc_cache.c
@@ -1189,10 +1189,9 @@ SAL_CALL rtl_cache_alloc (
if (cache == 0)
return (0);
+ RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock));
if (cache->m_cpu_curr != 0)
{
- RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock));
-
for (;;)
{
/* take object from magazine layer */
@@ -1230,9 +1229,8 @@ SAL_CALL rtl_cache_alloc (
/* no full magazine: fall through to slab layer */
break;
}
-
- RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock));
}
+ RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock));
/* alloc buffer from slab layer */
obj = rtl_cache_slab_alloc (cache);