pyamsoft / pydroid

pyamsoft Android library
https://pyamsoft.blogspot.com/
Apache License 2.0
22 stars 7 forks source link

Remove mutexes where possible #435

Closed pyamsoft closed 1 month ago

pyamsoft commented 1 month ago

Mutexes are in theory twice as expensive as an atomic coroutine's operation, as a mutex itself must internally apply an atomic operation to lock and another to unlock.

We should be able to kill mutex via a MSF update method, and for situations where we don't need observability, a lighter class could be implemented.

pyamsoft commented 1 month ago

Actually, since a mutex is not synchronized, it is also implemented with purely wait loop atomics, so theres no real benefit to changing code.