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
Showing
- system/osi/Android.mk 3 additions, 2 deletionssystem/osi/Android.mk
- system/osi/BUILD.gn 1 addition, 0 deletionssystem/osi/BUILD.gn
- system/osi/include/leaky_bonded_queue.h 158 additions, 0 deletionssystem/osi/include/leaky_bonded_queue.h
- system/osi/test/leaky_bonded_queue_test.cc 242 additions, 0 deletionssystem/osi/test/leaky_bonded_queue_test.cc
Loading
Please register or sign in to comment