OSDN Git Service

fifo: improve blocking and hysteresis
authorGlenn Kasten <gkasten@google.com>
Sun, 2 Oct 2016 20:00:19 +0000 (13:00 -0700)
committerGlenn Kasten <gkasten@google.com>
Wed, 12 Oct 2016 23:52:16 +0000 (16:52 -0700)
commitc0924bc38334c7adbf8cbc9cfa9d00559c002652
treee975a36b49e362bed9de64d77d109578b09aa14b
parentb49d47d0a272b9f40fc9b79973769f5ed8671b35
fifo: improve blocking and hysteresis

Work-in-progress to eventually allow the application to independently
specify whether or not each index (both front and rear) is also treated
as a futex, and if so whether it is single-process or multi-process.
This involves replacing mIsPrivate by an enum for futex types.
Still to do:
 - provide an API to configure this
 - better testing

Continued work on the setHysteresis() API.
Still to do:
 - better testing and debugging, especially for the read side.
 - do the right thing based on data currently in the buffer

Added available() API to return the number of frames that could
be obtain()ed.  For reader, this is the fill level.

Miscellaneous:
 - renamed sharedRear to writerRear
 - improved Doxygen comments
 - address code review comments by explaining why some paramters are
   passed by reference and some as pointers
 - updated tests
 - fixed bug: iovec was not being clear on error
 - changed default value of throttlesWriter to true

Test: tests/fifo_*
Change-Id: I0e19052abc90453ca48a0299d2c2de62468de6cb
audio_utils/fifo.cpp
audio_utils/include/audio_utils/fifo.h
audio_utils/tests/fifo_multiprocess.cpp
audio_utils/tests/fifo_tests.cpp
audio_utils/tests/fifo_threads.cpp