summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/device3/Camera3Device.h
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2015-08-12 12:55:02 -0700
committerRuben Brunk <rubenbrunk@google.com>2015-08-12 14:13:16 -0700
commit183f056393423b344e73f388f21d30379a38e519 (patch)
treea3ea7463340322257cc66457f66d43532cd6a0be /services/camera/libcameraservice/device3/Camera3Device.h
parent4327df2af078894c38a8eb69f4873bef92cc0f83 (diff)
downloadframeworks_av-183f056393423b344e73f388f21d30379a38e519.zip
frameworks_av-183f056393423b344e73f388f21d30379a38e519.tar.gz
frameworks_av-183f056393423b344e73f388f21d30379a38e519.tar.bz2
Fix deadlock conditions in Camera3Device.
Potential deadlock conditions this addresses, include: - Not waking up waiting threads for several situations where the status had been updated. - Not waking up all waiting thread when status had been updated (only one thread was awoken due to use of signal). - Threads clear status transitions before other waiting threads have a chance to examine them. Bug: 22448586 Change-Id: I53ba669d333a83d2bfa1ca3170d34acc6d8fe6e3
Diffstat (limited to 'services/camera/libcameraservice/device3/Camera3Device.h')
-rw-r--r--services/camera/libcameraservice/device3/Camera3Device.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index eea34af..0ea9b8b 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -205,7 +205,11 @@ class Camera3Device :
STATUS_CONFIGURED,
STATUS_ACTIVE
} mStatus;
+
+ // Only clear mRecentStatusUpdates, mStatusWaiters from waitUntilStateThenRelock
Vector<Status> mRecentStatusUpdates;
+ int mStatusWaiters;
+
Condition mStatusChanged;
// Tracking cause of fatal errors when in STATUS_ERROR
@@ -276,6 +280,13 @@ class Camera3Device :
virtual CameraMetadata getLatestRequestLocked();
/**
+ * Update the current device status and wake all waiting threads.
+ *
+ * Must be called with mLock held.
+ */
+ void internalUpdateStatusLocked(Status status);
+
+ /**
* Pause processing and flush everything, but don't tell the clients.
* This is for reconfiguring outputs transparently when according to the
* CameraDeviceBase interface we shouldn't need to.