AcquireReference() now returns the previous ref count.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42079 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ad12a198d7
commit
a99d0dd7b7
@ -17,7 +17,7 @@ public:
|
||||
BReferenceable();
|
||||
virtual ~BReferenceable();
|
||||
|
||||
void AcquireReference();
|
||||
int32 AcquireReference();
|
||||
bool ReleaseReference();
|
||||
// returns true after last
|
||||
|
||||
|
@ -28,13 +28,16 @@ BReferenceable::~BReferenceable()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
int32
|
||||
BReferenceable::AcquireReference()
|
||||
{
|
||||
if (atomic_add(&fReferenceCount, 1) == 0)
|
||||
int32 previousReferenceCount = atomic_add(&fReferenceCount, 1);
|
||||
if (previousReferenceCount == 0)
|
||||
FirstReferenceAcquired();
|
||||
|
||||
TRACE("%p: acquire %ld\n", this, fReferenceCount);
|
||||
|
||||
return previousReferenceCount;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user