March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
using System.Threading;
using System.Collections;
namespace Samples
{
public class SynchronizationLockExceptionSample
{
private static Object o = new Object();
public static void Main()
{
try
{
Monitor.Wait(o);
}
catch(SynchronizationLockException e)
{
Console.WriteLine("Exception: {0}", e);
}
}
}
}
Exception: System.Threading.SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code. at System.Threading.Monitor.ObjWait(Boolean exitContext, Int32 millisecondsTimeout, Object obj) at System.Threading.Monitor.Wait(Object obj, Int32 millisecondsTimeout, Boolean exitContext) at System.Threading.Monitor.Wait(Object obj) at Samples.SynchronizationLockExceptionSample.Main() ...
Read now
Unlock full access