summaryrefslogtreecommitdiff
path: root/sal/inc
diff options
context:
space:
mode:
authorStephan Bergmann <sb@openoffice.org>2002-10-28 08:55:07 +0000
committerStephan Bergmann <sb@openoffice.org>2002-10-28 08:55:07 +0000
commit2d694dc4953308c59bebdda77b42dd0be3d11d2a (patch)
tree8cca0d72d71671c58b9b8d3f52b2f0cf864073c0 /sal/inc
parent1b83e8d367532e7d7702f0b8d502f04e4ac7f122 (diff)
#104307# Improved placement of memory barrier.
Diffstat (limited to 'sal/inc')
-rw-r--r--sal/inc/osl/doublecheckedlocking.h7
-rw-r--r--sal/inc/rtl/instance.hxx10
2 files changed, 10 insertions, 7 deletions
diff --git a/sal/inc/osl/doublecheckedlocking.h b/sal/inc/osl/doublecheckedlocking.h
index 036b27846a6e..ff532b500fcc 100644
--- a/sal/inc/osl/doublecheckedlocking.h
+++ b/sal/inc/osl/doublecheckedlocking.h
@@ -2,9 +2,9 @@
*
* $RCSfile: doublecheckedlocking.h,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sb $ $Date: 2002-06-24 08:29:42 $
+ * last change: $Author: sb $ $Date: 2002-10-28 09:54:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -88,7 +88,6 @@ extern "C" {
static T * pInstance = 0;
T * p = pInstance;
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
if (!p)
{
Guard aGuard(aMutex);
@@ -100,6 +99,8 @@ extern "C" {
pInstance = p;
}
}
+ else
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
return p;
One extra advantage of this macro is that it makes it easier to find all
diff --git a/sal/inc/rtl/instance.hxx b/sal/inc/rtl/instance.hxx
index 01fc33900079..161b2e3487dc 100644
--- a/sal/inc/rtl/instance.hxx
+++ b/sal/inc/rtl/instance.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: instance.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: sb $ $Date: 2002-06-24 08:34:49 $
+ * last change: $Author: sb $ $Date: 2002-10-28 09:55:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -302,7 +302,6 @@ public:
static Inst * m_pInstance = 0;
#endif // _MSC_VER
Inst * p = m_pInstance;
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
if (!p)
{
Guard aGuard(aGuardCtor());
@@ -314,6 +313,8 @@ public:
m_pInstance = p;
}
}
+ else
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
return p;
}
@@ -324,7 +325,6 @@ public:
static Inst * m_pInstance = 0;
#endif // _MSC_VER
Inst * p = m_pInstance;
- OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
if (!p)
{
Data aData(aDataCtor());
@@ -337,6 +337,8 @@ public:
m_pInstance = p;
}
}
+ else
+ OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
return p;
}