OSDN Git Service

BufferQueue: release mutex while allocating.
authorAntoine Labour <piman@google.com>
Wed, 16 Jul 2014 04:17:03 +0000 (21:17 -0700)
committerAntoine Labour <piman@google.com>
Wed, 16 Jul 2014 21:43:19 +0000 (14:43 -0700)
commitea96044470a29133321c681080870b9d31f81a19
treef863f5965d255194f389e4d41947d4cc97387ff9
parent134a6a2594d3e9df5f150579abbcb8696ed286f9
BufferQueue: release mutex while allocating.

BufferQueueProducer::allocateBuffers used to keep the BufferQueueCore
mutex while doing the buffer allocation, which would cause the consumer
(which also needs the mutex) to block if the allocation takes a long
time.
Instead, release the mutex while doing the allocation, and grab it again
before filling the slots. Keep a bool state and a condvar to prevent
other producers from trying to allocate the slots while the mutex is
released.

Bug: 11792166

Change-Id: I4ab1319995ef892be2beba892f1fdbf50ce0416d
include/gui/BufferQueueCore.h
libs/gui/BufferQueueCore.cpp
libs/gui/BufferQueueProducer.cpp