Using a Mutex to Access Common Resources Safely
Your app’s task agent may be invoked even when your app is in the foreground. It is, therefore, important to ensure that simultaneous access to shared resources, such as files in isolated storage, is controlled and performed safely.
System.Threading.Mutex can be employed to synchronize critical sections of code—code that accesses a common resource—within your primary app and your background agent. A
Mutex is a synchronization primitive. It is similar to the
Monitor class, but with a scope that allows you to achieve interprocess synchronization, enabling you to synchronize across your foreground app and your background agent.
Unlike Silverlight for the browser, a
Mutex instance in Windows Phone ...