Core/Ptr: Changed to less risky code

git-svn-id: svn://ultimatepp.org/upp/trunk@9393 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-01-11 12:55:26 +00:00
parent 37307612ee
commit 7815dd533e

View file

@ -27,13 +27,10 @@ static StaticCriticalSection sPteLock;
PteBase::Prec *PteBase::PtrAdd()
{
sPteLock.Enter();
if(prec) {
CriticalSection::Lock __(sPteLock);
if(prec)
++prec->n;
sPteLock.Leave();
}
else {
sPteLock.Leave();
prec = new Prec;
prec->n = 1;
prec->ptr = this;