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
Loading
Please register or sign in to comment