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

Skip to content
Commit 536e0b47 authored by Yurii Zubrytskyi's avatar Yurii Zubrytskyi
Browse files

[res] Make TargetContainer thread safe

idmap2d caches target containers, and that cached container can
be used from multiple binder threads at once. If any of those
threads tries to initialize the assets for the first time, it
causes crashes in all other threads as they get their zip_ field
cleared from under their reads. This CL ensures that all access
to the mutable fields are under a lock.

This shouldn't cause any notable differences in performance, as
that access is usually a single pointer read. When it's not,
it's loading the whole APK of assets, and we're still better off
waiting for the thread that is doing it vs loading the same APK
in parallel.

+ a few missing std::move() calls

Bug: b/377804994
Test: build + boot + atest idmap2_tests
Flag: EXEMPT bugfix, adding a mutex is unflaggable
Change-Id: I17223e2567434b177f21ab044cfdb737a74bf6de
parent d0c4ff5d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment