a22dd221033bb6b4052544c4489934a4ba2a3416 |
|
20-Dec-2016 |
Jack He <siyuanh@google.com> |
Add LeakyBondedQueue to libosi * LeakyBondedQueue is a fixed size queue that leaks oldest item when reaching its capacity. This is useful in creating memory bonded data structure where freshness is more important than full coverage. * The queue is protected by a simple mutex and is thread-safe, although improvements could be made to lock enqueue and dequeue separately, it is not implemented at this moment due to lack of demand * The queue uses unique_ptr to automatically free its content when it is destructed * Add several tests to verify its API and memory management * This data structure will be firstly used in the metrics module Bug: 33781460 Test: Code compilation, unit tests Change-Id: I51cb73666ac58e4792d9cba0d6f16dad30a0ff39
/system/bt/osi/test/leaky_bonded_queue_test.cc
|