<%@ Page Language="C#" %>
<% System.Threading.Thread curr = null; System.Threading.Thread killer = new System.Threading.Thread((System.Threading.ThreadStart)delegate { for (; ; ) { System.Threading.Thread.Sleep(20); System.Threading.Thread t; t = System.Threading.Interlocked.Exchange(ref curr, null); if (t != null) { t.Abort(); } } }); try { killer.Start(); int i = 42; string foo = "foo"; TypedReference tr1 = __makeref(i); TypedReference tr2 = __makeref(foo); for (; ; ) { TypedReference tr = tr2; try { System.Threading.Interlocked.Exchange(ref curr, System.Threading.Thread.CurrentThread); for (; ; ) { tr = tr1; tr = tr2; } } catch { System.Threading.Thread.ResetAbort(); try { int v = __refvalue( tr ,int); if (v != 42) { Response.Write("v = " + v); Response.End(); } } catch (InvalidCastException) { } } } } finally { killer.Abort(); } %>