summaryrefslogtreecommitdiff
path: root/system/gd/os/linux_generic/queue_unittest.cc
AgeCommit message (Collapse)Author
2022-03-09check check, is anyone there? *static*Zach Johnson
* statically link libbluetooth into libbluetooth_jni * clean up some build rule defaults * statically link libchrome * stop using whole static libs, to increase ability to prune unused code :party: :party: Still some issue on local test. I suppose they should only be run in the test suite. Test are: * bluetooth-test-audio-hal-interface * bluetooth_flatbuffer_bundler_test * net_test_rfcomm_suite * net_test_stack_rfcomm Bug: 220805766 Test: compile, verify BT boots & basic use cases work Testeted with all cc_test in packages/modules/Bluetooth: atest $(grep -w cc_test -A 1 $(find packages/modules/Bluetooth -name Android.bp) | grep name | cut -d '"' -f 2) Test: m bluetoothtbd Test: atest bluetoothtbd_test Ignore-AOSP-First: apex changes not in AOSP yet Change-Id: I0d232c8bcbe1f9065c6e6caa75021a6cd627c78f
2020-05-18Format gd/os with new clang-formatZach Johnson
find os -regex '.*\.\(cc\|h\|tpp\)' -exec clang-format -style=file -i {} \; Test: cert/run --host Bug: 156858180 Tag: #gd-refactor Change-Id: I567f20faa1dee599bda4d9d6e7a8a16586574d6c
2020-03-05OS Queue and Reactor: Minor fixesHansong Zhang
* When deleting EnqueueBuffer, unregister if needed * Add a mutex to Reactor::WaitForUnregisteredReactable to prevent from potential race * EnqueueBuffer: Use an atomic_bool to synchronize Register/Unregister Bug: 150174451 Test: cert/run --device Change-Id: I7abcc2f763f8f0575dc0c67141571904c9a20136
2020-03-03Queue: Wait for unregistration if on different threadHansong Zhang
Before Queue object is deleted, we must make sure that the enqueue or dequeue callback isn't executing. If on same thread, callbacks are synchronized. If on different thread, we must wait for unregistration to synchronize callbacks. Test: bluetooth_test_gd Bug: 150174451 Change-Id: Id3c980aa0bf7bd9fa10c33c5cca3751df38f7d97
2019-07-25OS: Account for enqueue/dequeue raceMyles Watson
Test: on-device: bluetooth_test_gd --gtest_filter=*Queue* Change-Id: I3429e35ebd9a98f1054e40e9507995daeae35c65
2019-07-23OS: Get promise before registering in testsMyles Watson
https://cplusplus.github.io/LWG/issue2412 Test: on-device: bluetooth_test_gd --gtest_filter=*Queue* Change-Id: I2603763ea6c9197ed56f741b2beb100c1a9b8e19
2019-07-09ACL manager certHansong Zhang
Test: cert/run_cert.sh Change-Id: I89814224be191fd97a2581b3a36eed67748be7c5
2019-06-19OS Queue: Add Enqueue BufferHansong Zhang
Enqueue Buffer is a common interface to handle RegisterEnqueue() and UnregisterEnqueue() according to current buffer size Test: bluetooth_test_gd Change-Id: I5b3ef749cd09f866a6c676af403ab6fa39d34701
2019-06-12Replace std::function with base::ClosureHansong Zhang
std::function doesn't support non-copyable arguments. Use base::Closure and base::OnceClosure from libchrome instead. Test: atest --host bluetooth_test_gd Change-Id: Ic18bbc000730e8b0d7acff0097870bd258ee6150
2019-06-12OS: Add ordering guarantees for Handler.Clear()Myles Watson
Assert that Clear() is called once before ~Handler() Test: bluetooth_test_gd Change-Id: I40f89d13a05deab5f0d7ab1596a9101b097ef52a
2019-06-03OS: Add death tests for en/de-queue registrationMyles Watson
Test: bluetooth_gd_test Change-Id: Iadf126018a2c919fa10096506009674e7a2cd73c
2019-06-03Revert "OS: Construct Handler using Reactor"Myles Watson
Reactors are an implementation-specific detail. This reverts commit 86d57ec783839f068675114f6772c45f9782fff9. Test: bluetooth_gd_test Change-Id: If74a9e0f32671ba96a723e51eee495f2aebf1e7c
2019-05-24OS: Construct Handler using ReactorMyles Watson
Store a Reactor instead of a Thread in Handler. Allow construction from either. Test: bluetooth_test_gd --gtest_filter=QueueTestSingleThread.no_unregister_enqueue_death_test Change-Id: I610e6f4ffb48120d1fa47b4ff59b59375c7a11d8
2019-05-24Queue: Store callbacks in the runnableMyles Watson
Test: bluetooth_test_gd \ --gtest_filter=QueueTest.pass_smart_pointer_and_unregister Change-Id: Ib7dc12d8e767125e51d83810ade77c5187a4c174
2019-05-17QueueTest: UnregisterDequeue before promise set valueChienyuan
For some tests, ~Queue will() be trigger right after we get promise we should UnregisterDequeue before promise set value to prevent race condition Test: atest bluetooth_test_gd Change-Id: I9409b6829cce61ef95c766a1d3b3679197b8f9f4
2019-04-12Implement QueueChienyuan
* Implement Queue which provides a flow control mechanism for data transmission between modules. This queue streaming data with EnqueueCallback and DequeueCallback based on the reactor pattern. Enqueue end should register callback when data is ready to be sent and unregister when no data ready to send. Dequeue end should register callback when ready to handle data and unregister when not ready to handle data. * Implement ReactiveSemaphore, a wrapper for an event_fd work in non-blocking and Semaphore mode used by Queue to handle readable signal in the reactor pattern. Test: run bluetooth_test_gd Change-Id: Ia7019cdbe271d193c92f1a0b405ecced41a2d84b