Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit d1e9ca2c authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Make *Repository#get(int userId) lock-free

This reworks how IME-related per-user data can be queried in a
thread-safe manner.

Basically the idea is to make query operations lock-free by making
sure that the underlying SparseArray is immutable. While we still need
a lock for data mutation, simple read access no longer requires any
lock at the cost of putting the sparse array into a volatile field,
which has gotten pretty cheap on both ARM and remain so on X86 at
least compared to synchronized blocks.

There must be no observable behavior change beyond the performance
characteristics.

Bug: 353307830
Fix: 352594784
Test: atest FrameworksInputMethodSystemServerTests:ImmutableSparseArrayTest
Flag: EXEMPT refactor
Change-Id: Id0783e57c7e8ff70f16f3c3d486f5a5e64bbe7db
parent e47b907e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment