summaryrefslogtreecommitdiff
path: root/libs/rs/rsContext.cpp
diff options
context:
space:
mode:
author Jason Sams <rjsams@android.com> 2010-03-18 11:39:44 -0700
committer Jason Sams <rjsams@android.com> 2010-03-26 14:20:26 -0700
commitc1d726c2d62424867ec14f2cde16b00fe0ddfee1 (patch)
tree96c26ed697d6c2331a9aa5b0a5e5706b9a1fa9ea /libs/rs/rsContext.cpp
parent3cfae1bbf41e12fe2749c5f4a97507c19a8beb1b (diff)
Seperate out Mutex and Signal code into reusable classes.
Change-Id: I381d09d89b567d433a10a91e0d7e59c24d3444d8
Diffstat (limited to 'libs/rs/rsContext.cpp')
-rw-r--r--libs/rs/rsContext.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index d8a9a997b9df..4107229ddf17 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -664,8 +664,7 @@ void Context::appendNameDefines(String8 *str) const
bool Context::objDestroyOOBInit()
{
- int status = pthread_mutex_init(&mObjDestroy.mMutex, NULL);
- if (status) {
+ if (!mObjDestroy.mMutex.init()) {
LOGE("Context::ObjDestroyOOBInit mutex init failure");
return false;
}
@@ -675,9 +674,8 @@ bool Context::objDestroyOOBInit()
void Context::objDestroyOOBRun()
{
if (mObjDestroy.mNeedToEmpty) {
- int status = pthread_mutex_lock(&mObjDestroy.mMutex);
- if (status) {
- LOGE("Context::ObjDestroyOOBRun: error %i locking for OOBRun.", status);
+ if (!mObjDestroy.mMutex.lock()) {
+ LOGE("Context::ObjDestroyOOBRun: error locking for OOBRun.");
return;
}
@@ -686,35 +684,25 @@ void Context::objDestroyOOBRun()
}
mObjDestroy.mDestroyList.clear();
mObjDestroy.mNeedToEmpty = false;
-
- status = pthread_mutex_unlock(&mObjDestroy.mMutex);
- if (status) {
- LOGE("Context::ObjDestroyOOBRun: error %i unlocking for set condition.", status);
- }
+ mObjDestroy.mMutex.unlock();
}
}
void Context::objDestroyOOBDestroy()
{
rsAssert(!mObjDestroy.mNeedToEmpty);
- pthread_mutex_destroy(&mObjDestroy.mMutex);
}
void Context::objDestroyAdd(ObjectBase *obj)
{
- int status = pthread_mutex_lock(&mObjDestroy.mMutex);
- if (status) {
- LOGE("Context::ObjDestroyOOBRun: error %i locking for OOBRun.", status);
+ if (!mObjDestroy.mMutex.lock()) {
+ LOGE("Context::ObjDestroyOOBRun: error locking for OOBRun.");
return;
}
mObjDestroy.mNeedToEmpty = true;
mObjDestroy.mDestroyList.add(obj);
-
- status = pthread_mutex_unlock(&mObjDestroy.mMutex);
- if (status) {
- LOGE("Context::ObjDestroyOOBRun: error %i unlocking for set condition.", status);
- }
+ mObjDestroy.mMutex.unlock();
}
uint32_t Context::getMessageToClient(void *data, size_t *receiveLen, size_t bufferLen, bool wait)