diff options
| author | 2022-12-29 03:12:52 -0800 | |
|---|---|---|
| committer | 2022-12-29 12:17:11 +0000 | |
| commit | eb039c3f01b211ced8356ebfce174b760f0137ed (patch) | |
| tree | f56dc2148d6d776147423f79417251046f0059d5 /libs/androidfw/StringPool.cpp | |
| parent | da209b100afa30f7bee2a8c30114757d22c46964 (diff) | |
ImageWriter: remove mCloseLock guard from queue and dequeue operations
mCloseLock currently guards #queueInputImage, #dequeueInputImage, and
#postEventFromNative. However, there have been cases reported where a
contention between #postEventFromNative and #queueInputImage would lead
to a deadlock. This CL removes the mCloseLock guard from #queueInputImage
and #dequeInputImage as the native implementations are already
synchronized on `this` and there are no reported bugs from race
conditions in those two functions.
It also drops the mCloseLock guard from #postEventFromNative and moves
the responsibility of ensuring ImageWriter is valid to the
ListenerHandler. This ensures that mCloseLock is never in contention
in the JNI thread that calls #postEventFromNative.
#close() is still protected by mCloseLock to prevent multiple
simultaneous closes.
Bug: 263395157
Test: Existing ImageWriter tests pass
Ran the sequence that led to deadlock 30 times without a single
deadlock.
Change-Id: I5b0d367cce7df9401386e5a53c5e9b539d8c1f40
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions