diff options
author | Christopher Wiley <wiley@google.com> | 2016-02-16 16:50:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-02-16 16:50:01 +0000 |
commit | d3a9228d1d2388f21b4e8013cf2fad7b4c91ace7 (patch) | |
tree | 45e548e4131ba9556bd686ed11783b6ab9176829 | |
parent | 39f1abac3c21e2f5a4a450b21d1c52ba5f099ddb (diff) | |
parent | 5975c00c4a3b9cca08e6e960826d4bdec93c2dbf (diff) | |
download | native-d3a9228d1d2388f21b4e8013cf2fad7b4c91ace7.tar.gz |
Merge "Replace AppOpsManager locking with std::lock_guard"
-rw-r--r-- | libs/binder/AppOpsManager.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/binder/AppOpsManager.cpp b/libs/binder/AppOpsManager.cpp index 52cef1c5bf..e97bde576a 100644 --- a/libs/binder/AppOpsManager.cpp +++ b/libs/binder/AppOpsManager.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <mutex> #include <binder/AppOpsManager.h> #include <binder/Binder.h> #include <binder/IServiceManager.h> @@ -59,8 +60,8 @@ sp<IAppOpsService> AppOpsManager::getService() { return NULL; } sp<IAppOpsService> AppOpsManager::getService() { + std::lock_guard<Mutex> scoped_lock(mLock); int64_t startTime = 0; - mLock.lock(); sp<IAppOpsService> service = mService; while (service == NULL || !IInterface::asBinder(service)->isBinderAlive()) { sp<IBinder> binder = defaultServiceManager()->checkService(_appops); @@ -80,7 +81,6 @@ sp<IAppOpsService> AppOpsManager::getService() mService = service; } } - mLock.unlock(); return service; } #endif // defined(__BRILLO__) |