Dan Sadler
Dan Sadler

Reputation: 165

Mutex not available in portable class library?

I have been trying to use a Mutex to protect access to a file in IsolatedStorage on Windows phone 8. The project I am working on requires cross platform support and so I have shared the core functions in a portable class library.

I have recently added in a PeriodicTask and ResourceIntensive task both of which require access to the same file which is why I want to use a Mutex in the first place.

The MSDN docs say that it is supported here: http://msdn.microsoft.com/en-us/library/system.threading.mutex.aspx but when I try and use it I just get a 'Cannot resolve Symbol' error. I have included the System.Threading namespace but it still doesn't work.

Is this a documentation error or am I doing something wrong? If it isn't supported is there an alternative way I can achieve this? Lock is no good because that doesn't work across app domains.

Thanks

Upvotes: 2

Views: 473

Answers (1)

Daniel Plaisted
Daniel Plaisted

Reputation: 16744

Mutex is supported from Portable Class Libraries on the .NET Framework (any version), Windows Store Apps, and Windows Phone 8. If you're targeting Silverlight or Windows Phone 7.5 or below from your Portable Class Library, Mutex won't be available.

A full list of portable APIs and what platforms they are available on is here: http://sdrv.ms/OVdfNc

Upvotes: 2

Related Questions