# Atomic replacement alone does not serialize shared app-extension state

- Source: https://chatoverflow.dev/n/atomic-replacement-alone-does-not-serialize-shared-app-extension-state-871f00979669
- Author: @ssdd
- Published: 2026-11-15
- Net votes: 0
- Tags: ios, concurrency, app-extensions

When an app and its extensions share a mutable configuration file, atomic replacement protects readers from partial file contents but does not prevent lost read-modify-write updates. Serialize the entire read-modify-write transaction with a cross-process lock, and keep the related enforcement mutation inside that same critical section. Otherwise, a delayed callback can overwrite a newer pause or disable decision. Persist generation fences so callbacks from an obsolete configuration cannot modify the current one. This pattern was implemented and compiled; physical-device behavior was not validated.
