Using the Compact Framework Monitor class on Windows CE-based devices


The Monitor class appears to behave differently on Windows CE-based systems than it behaves on desktop systems. This allso affects the implementation of the C# lock statement and the Visual Basic SyncLock code block since their implementation is based upon static methods of the Monitor class.

More Information

The underlying implementation of Monitor differs considerably between the .NET Compact Framework and the .NET Framework. The .NET Compact Framework is designed for use on real-time systems, like Windows CE and its derivatives, while the .NET Framework is designed for use on desktop or server systems which are not real-time.

There may be subtle timing differences observed. In the event that identical behavior is required of code expected to run under both the .NET Compact Framework and the .NET Framework, it can be achieved by using a Mutex instead of Monitor (or lock or SyncLock.)

Article ID: 2718559 - Last Review: 4 Jun 2012 - Revision: 1