Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "rsObjectBase.h" |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 18 | #include "rsContext.h" |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 19 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 20 | using namespace android; |
| 21 | using namespace android::renderscript; |
| 22 | |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 23 | pthread_mutex_t ObjectBase::gObjectInitMutex = PTHREAD_MUTEX_INITIALIZER; |
| 24 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 25 | ObjectBase::ObjectBase(Context *rsc) { |
Jason Sams | 9397e30 | 2009-08-27 20:23:34 -0700 | [diff] [blame] | 26 | mUserRefCount = 0; |
| 27 | mSysRefCount = 0; |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 28 | mRSC = rsc; |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 29 | mNext = NULL; |
| 30 | mPrev = NULL; |
Stephen Hines | d216daf | 2013-04-02 16:32:34 -0700 | [diff] [blame] | 31 | mDH = NULL; |
Stephen Hines | b0934b6 | 2013-07-03 17:27:38 -0700 | [diff] [blame] | 32 | mName = NULL; |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 33 | |
| 34 | #if RS_OBJECT_DEBUG |
Stephen Hines | d216daf | 2013-04-02 16:32:34 -0700 | [diff] [blame] | 35 | mDH = new DebugHelper(); |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 36 | #endif |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 37 | |
| 38 | rsAssert(rsc); |
| 39 | add(); |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 40 | //ALOGV("ObjectBase %p con", this); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 41 | } |
| 42 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 43 | ObjectBase::~ObjectBase() { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 44 | //ALOGV("~ObjectBase %p ref %i,%i", this, mUserRefCount, mSysRefCount); |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 45 | #if RS_OBJECT_DEBUG |
Stephen Hines | d216daf | 2013-04-02 16:32:34 -0700 | [diff] [blame] | 46 | mDH->dump(); |
| 47 | delete mDH; |
| 48 | mDH = NULL; |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 49 | #endif |
| 50 | |
Stephen Hines | b0934b6 | 2013-07-03 17:27:38 -0700 | [diff] [blame] | 51 | free(const_cast<char *>(mName)); |
| 52 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 53 | if (mPrev || mNext) { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 54 | // While the normal practice is to call remove before we call |
| 55 | // delete. Its possible for objects without a re-use list |
| 56 | // for avoiding duplication to be created on the stack. In those |
| 57 | // cases we need to remove ourself here. |
| 58 | asyncLock(); |
| 59 | remove(); |
| 60 | asyncUnlock(); |
| 61 | } |
| 62 | |
Jason Sams | 9397e30 | 2009-08-27 20:23:34 -0700 | [diff] [blame] | 63 | rsAssert(!mUserRefCount); |
| 64 | rsAssert(!mSysRefCount); |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 65 | } |
| 66 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 67 | void ObjectBase::dumpLOGV(const char *op) const { |
Stephen Hines | b0934b6 | 2013-07-03 17:27:38 -0700 | [diff] [blame] | 68 | if (mName) { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 69 | ALOGV("%s RSobj %p, name %s, refs %i,%i links %p,%p,%p", |
Stephen Hines | b0934b6 | 2013-07-03 17:27:38 -0700 | [diff] [blame] | 70 | op, this, mName, mUserRefCount, mSysRefCount, mNext, mPrev, mRSC); |
Jason Sams | f2649a9 | 2009-09-25 16:37:33 -0700 | [diff] [blame] | 71 | } else { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 72 | ALOGV("%s RSobj %p, no-name, refs %i,%i links %p,%p,%p", |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 73 | op, this, mUserRefCount, mSysRefCount, mNext, mPrev, mRSC); |
Jason Sams | f2649a9 | 2009-09-25 16:37:33 -0700 | [diff] [blame] | 74 | } |
| 75 | } |
| 76 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 77 | void ObjectBase::incUserRef() const { |
Tim Murray | 0b575de | 2013-03-15 15:56:43 -0700 | [diff] [blame] | 78 | __sync_fetch_and_add(&mUserRefCount, 1); |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 79 | //ALOGV("ObjectBase %p incU ref %i, %i", this, mUserRefCount, mSysRefCount); |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 80 | } |
| 81 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 82 | void ObjectBase::incSysRef() const { |
Tim Murray | 0b575de | 2013-03-15 15:56:43 -0700 | [diff] [blame] | 83 | __sync_fetch_and_add(&mSysRefCount, 1); |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 84 | //ALOGV("ObjectBase %p incS ref %i, %i", this, mUserRefCount, mSysRefCount); |
Jason Sams | 9397e30 | 2009-08-27 20:23:34 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 87 | void ObjectBase::preDestroy() const { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 88 | } |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 89 | |
Jason Sams | c7cec1e | 2011-08-18 18:01:33 -0700 | [diff] [blame] | 90 | bool ObjectBase::freeChildren() { |
| 91 | return false; |
| 92 | } |
| 93 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 94 | bool ObjectBase::checkDelete(const ObjectBase *ref) { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 95 | if (!ref) { |
| 96 | return false; |
| 97 | } |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 98 | |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 99 | asyncLock(); |
| 100 | // This lock protects us against the non-RS threads changing |
| 101 | // the ref counts. At this point we should be the only thread |
| 102 | // working on them. |
| 103 | if (ref->mUserRefCount || ref->mSysRefCount) { |
| 104 | asyncUnlock(); |
| 105 | return false; |
| 106 | } |
| 107 | |
| 108 | ref->remove(); |
| 109 | // At this point we can unlock because there should be no possible way |
| 110 | // for another thread to reference this object. |
| 111 | ref->preDestroy(); |
| 112 | asyncUnlock(); |
| 113 | delete ref; |
| 114 | return true; |
| 115 | } |
| 116 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 117 | bool ObjectBase::decUserRef() const { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 118 | rsAssert(mUserRefCount > 0); |
Jason Sams | f0c1df4 | 2010-10-26 13:09:17 -0700 | [diff] [blame] | 119 | #if RS_OBJECT_DEBUG |
Jason Sams | 110f181 | 2013-03-14 16:02:18 -0700 | [diff] [blame] | 120 | //ALOGV("ObjectBase %p decU ref %i, %i", this, mUserRefCount, mSysRefCount); |
Jason Sams | f0c1df4 | 2010-10-26 13:09:17 -0700 | [diff] [blame] | 121 | if (mUserRefCount <= 0) { |
Stephen Hines | d216daf | 2013-04-02 16:32:34 -0700 | [diff] [blame] | 122 | mDH->dump(); |
Jason Sams | f0c1df4 | 2010-10-26 13:09:17 -0700 | [diff] [blame] | 123 | } |
| 124 | #endif |
| 125 | |
| 126 | |
Tim Murray | 0b575de | 2013-03-15 15:56:43 -0700 | [diff] [blame] | 127 | if ((__sync_fetch_and_sub(&mUserRefCount, 1) <= 1)) { |
| 128 | __sync_synchronize(); |
| 129 | if (mSysRefCount <= 0) { |
| 130 | return checkDelete(this); |
| 131 | } |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 132 | } |
| 133 | return false; |
| 134 | } |
| 135 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 136 | bool ObjectBase::zeroUserRef() const { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 137 | //ALOGV("ObjectBase %p zeroU ref %i, %i", this, mUserRefCount, mSysRefCount); |
Tim Murray | 0b575de | 2013-03-15 15:56:43 -0700 | [diff] [blame] | 138 | __sync_and_and_fetch(&mUserRefCount, 0); |
Stephen Hines | 61c8695 | 2013-04-09 17:34:43 -0700 | [diff] [blame] | 139 | if (mSysRefCount <= 0) { |
| 140 | return checkDelete(this); |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 141 | } |
| 142 | return false; |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 143 | } |
| 144 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 145 | bool ObjectBase::decSysRef() const { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 146 | //ALOGV("ObjectBase %p decS ref %i, %i", this, mUserRefCount, mSysRefCount); |
Jason Sams | 9397e30 | 2009-08-27 20:23:34 -0700 | [diff] [blame] | 147 | rsAssert(mSysRefCount > 0); |
Tim Murray | 0b575de | 2013-03-15 15:56:43 -0700 | [diff] [blame] | 148 | if ((__sync_fetch_and_sub(&mSysRefCount, 1) <= 1)) { |
| 149 | __sync_synchronize(); |
| 150 | if (mUserRefCount <= 0) { |
| 151 | return checkDelete(this); |
| 152 | } |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 153 | } |
| 154 | return false; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 157 | void ObjectBase::setName(const char *name) { |
Stephen Hines | b0934b6 | 2013-07-03 17:27:38 -0700 | [diff] [blame] | 158 | mName = strdup(name); |
Jason Sams | a0a1b6f | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 159 | } |
Jason Sams | a4a54e4 | 2009-06-10 18:39:40 -0700 | [diff] [blame] | 160 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 161 | void ObjectBase::setName(const char *name, uint32_t len) { |
Stephen Hines | b0934b6 | 2013-07-03 17:27:38 -0700 | [diff] [blame] | 162 | char *c = (char*)calloc(len + 1, sizeof(char)); |
| 163 | rsAssert(c); |
| 164 | memcpy(c, name, len); |
| 165 | mName = c; |
Jason Sams | a4a54e4 | 2009-06-10 18:39:40 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 168 | void ObjectBase::asyncLock() { |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 169 | pthread_mutex_lock(&gObjectInitMutex); |
| 170 | } |
| 171 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 172 | void ObjectBase::asyncUnlock() { |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 173 | pthread_mutex_unlock(&gObjectInitMutex); |
| 174 | } |
| 175 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 176 | void ObjectBase::add() const { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 177 | asyncLock(); |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 178 | |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 179 | rsAssert(!mNext); |
| 180 | rsAssert(!mPrev); |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 181 | //ALOGV("calling add rsc %p", mRSC); |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 182 | mNext = mRSC->mObjHead; |
| 183 | if (mRSC->mObjHead) { |
| 184 | mRSC->mObjHead->mPrev = this; |
| 185 | } |
| 186 | mRSC->mObjHead = this; |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 187 | |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 188 | asyncUnlock(); |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 189 | } |
| 190 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 191 | void ObjectBase::remove() const { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 192 | //ALOGV("calling remove rsc %p", mRSC); |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 193 | if (!mRSC) { |
| 194 | rsAssert(!mPrev); |
| 195 | rsAssert(!mNext); |
| 196 | return; |
| 197 | } |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 198 | |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 199 | if (mRSC->mObjHead == this) { |
| 200 | mRSC->mObjHead = mNext; |
| 201 | } |
| 202 | if (mPrev) { |
| 203 | mPrev->mNext = mNext; |
| 204 | } |
| 205 | if (mNext) { |
| 206 | mNext->mPrev = mPrev; |
| 207 | } |
| 208 | mPrev = NULL; |
| 209 | mNext = NULL; |
| 210 | } |
| 211 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 212 | void ObjectBase::zeroAllUserRef(Context *rsc) { |
Jason Sams | 1fddd90 | 2009-09-25 15:25:00 -0700 | [diff] [blame] | 213 | if (rsc->props.mLogObjects) { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 214 | ALOGV("Forcing release of all outstanding user refs."); |
Jason Sams | 1fddd90 | 2009-09-25 15:25:00 -0700 | [diff] [blame] | 215 | } |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 216 | |
| 217 | // This operation can be slow, only to be called during context cleanup. |
| 218 | const ObjectBase * o = rsc->mObjHead; |
| 219 | while (o) { |
Steve Block | af12ac6 | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 220 | //ALOGE("o %p", o); |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 221 | if (o->zeroUserRef()) { |
| 222 | // deleted the object and possibly others, restart from head. |
| 223 | o = rsc->mObjHead; |
Steve Block | af12ac6 | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 224 | //ALOGE("o head %p", o); |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 225 | } else { |
| 226 | o = o->mNext; |
Steve Block | af12ac6 | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 227 | //ALOGE("o next %p", o); |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 228 | } |
| 229 | } |
Jason Sams | f2649a9 | 2009-09-25 16:37:33 -0700 | [diff] [blame] | 230 | |
| 231 | if (rsc->props.mLogObjects) { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 232 | ALOGV("Objects remaining."); |
Jason Sams | 25afc00 | 2009-11-19 13:08:17 -0800 | [diff] [blame] | 233 | dumpAll(rsc); |
Jason Sams | f2649a9 | 2009-09-25 16:37:33 -0700 | [diff] [blame] | 234 | } |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 235 | } |
| 236 | |
Jason Sams | c7cec1e | 2011-08-18 18:01:33 -0700 | [diff] [blame] | 237 | void ObjectBase::freeAllChildren(Context *rsc) { |
| 238 | if (rsc->props.mLogObjects) { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 239 | ALOGV("Forcing release of all child objects."); |
Jason Sams | c7cec1e | 2011-08-18 18:01:33 -0700 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | // This operation can be slow, only to be called during context cleanup. |
| 243 | ObjectBase * o = (ObjectBase *)rsc->mObjHead; |
| 244 | while (o) { |
| 245 | if (o->freeChildren()) { |
| 246 | // deleted ref to self and possibly others, restart from head. |
| 247 | o = (ObjectBase *)rsc->mObjHead; |
| 248 | } else { |
| 249 | o = (ObjectBase *)o->mNext; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | if (rsc->props.mLogObjects) { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 254 | ALOGV("Objects remaining."); |
Jason Sams | c7cec1e | 2011-08-18 18:01:33 -0700 | [diff] [blame] | 255 | dumpAll(rsc); |
| 256 | } |
| 257 | } |
| 258 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 259 | void ObjectBase::dumpAll(Context *rsc) { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 260 | asyncLock(); |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 261 | |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 262 | ALOGV("Dumping all objects"); |
Jason Sams | 25afc00 | 2009-11-19 13:08:17 -0800 | [diff] [blame] | 263 | const ObjectBase * o = rsc->mObjHead; |
| 264 | while (o) { |
Steve Block | 6598201 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 265 | ALOGV(" Object %p", o); |
Jason Sams | 25afc00 | 2009-11-19 13:08:17 -0800 | [diff] [blame] | 266 | o->dumpLOGV(" "); |
| 267 | o = o->mNext; |
Jason Sams | c21cf40 | 2009-11-17 17:26:46 -0800 | [diff] [blame] | 268 | } |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 269 | |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 270 | asyncUnlock(); |
Jason Sams | c21cf40 | 2009-11-17 17:26:46 -0800 | [diff] [blame] | 271 | } |
| 272 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 273 | bool ObjectBase::isValid(const Context *rsc, const ObjectBase *obj) { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 274 | asyncLock(); |
Jason Sams | 2353ae3 | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 275 | |
Jason Sams | 605048a | 2010-09-30 18:15:52 -0700 | [diff] [blame] | 276 | const ObjectBase * o = rsc->mObjHead; |
| 277 | while (o) { |
| 278 | if (o == obj) { |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 279 | asyncUnlock(); |
Jason Sams | 605048a | 2010-09-30 18:15:52 -0700 | [diff] [blame] | 280 | return true; |
| 281 | } |
| 282 | o = o->mNext; |
| 283 | } |
Jason Sams | 225afd3 | 2010-10-21 14:06:55 -0700 | [diff] [blame] | 284 | asyncUnlock(); |
Jason Sams | 605048a | 2010-09-30 18:15:52 -0700 | [diff] [blame] | 285 | return false; |
| 286 | } |