Kaydet (Commit) 29d1303e authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Use atomic increment and decrement for thread-safe reference count.

Change-Id: I630298b1c37a6d23c1aa17aabc1c9b2dcb48608a
üst 1d996cee
......@@ -29,6 +29,7 @@
#include "formula/formuladllapi.h"
#include "formula/types.hxx"
#include "svl/sharedstring.hxx"
#include "osl/interlck.h"
namespace formula
{
......@@ -107,12 +108,18 @@ public:
bool IsFunction() const; // pure functions, no operators
bool IsExternalRef() const;
sal_uInt8 GetParamCount() const;
inline void IncRef() const { nRefCnt++; }
inline void DecRef() const
{
if (!--nRefCnt)
const_cast<FormulaToken*>(this)->Delete();
}
inline void IncRef() const
{
osl_atomic_increment(&nRefCnt);
}
inline void DecRef() const
{
if (!osl_atomic_decrement(&nRefCnt))
const_cast<FormulaToken*>(this)->Delete();
}
inline sal_uInt16 GetRef() const { return nRefCnt; }
inline OpCode GetOpCode() const { return eOp; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment