0

I have a BackgroundWorker that includes read/writes to IsolatedStorage. Right before the worker is run, I read from IsolatedStorage. Do I have to worry about using a Mutex, or will the worker only start once the read is completed?

//read from IsolatedStorage here

bgw.RunWorkerAsync();  //includes read/writes to IsolatedStorage
philorube
  • 155
  • 8

1 Answers1

1

There are few things you have to consider:

  • if your code before bgw.RunWorkerAsync(); is run synchronous,
  • if IsolatedStorage operations are performed also as synchronous,
  • if bgw is going to be only Task/Thread/Proccess using IsolatedStorage (check all events, methods, constructors... - also IsolatedStorageSettings, other methods eg. SaveJpg,
  • if you Disposed your ISF and all IsolatedStorageStreams

then there will be no problem and you can do it without Mutex. But IMO it will be much safer/better to use one - here in the answer you have a good pattern.

Community
  • 1
  • 1
Romasz
  • 29,662
  • 13
  • 79
  • 154