Migrating atomic ops to std::atomic where possible and poly.

This commit is contained in:
Ben Vanik
2014-07-12 17:48:54 -07:00
parent bf882714d0
commit 9b78dd977b
18 changed files with 174 additions and 139 deletions

View File

@@ -46,22 +46,22 @@ X_HANDLE XObject::handle() const {
}
void XObject::RetainHandle() {
xe_atomic_inc_32(&handle_ref_count_);
++handle_ref_count_;
}
bool XObject::ReleaseHandle() {
if (!xe_atomic_dec_32(&handle_ref_count_)) {
if (--handle_ref_count_ == 0) {
return true;
}
return false;
}
void XObject::Retain() {
xe_atomic_inc_32(&pointer_ref_count_);
++pointer_ref_count_;
}
void XObject::Release() {
if (!xe_atomic_dec_32(&pointer_ref_count_)) {
if (--pointer_ref_count_ == 0) {
assert_true(pointer_ref_count_ >= handle_ref_count_);
delete this;
}