//
//
//
//
// $Revision$
//
using System;
using System.Threading;
namespace Debugger.Tests.TestPrograms
{
public class MainThreadExit
{
static ManualResetEvent doSomething = new ManualResetEvent(false);
public static void Main()
{
System.Threading.Thread t = new System.Threading.Thread(WaitForALongTime);
t.Name = "Worker thread";
t.Start();
// RACE CONDITION: this does not guarantee that the worker thread will have started
// when the debugger breaks.
System.Threading.Thread.Sleep(0);
System.Diagnostics.Debugger.Break();
}
static void WaitForALongTime()
{
doSomething.WaitOne();
}
}
}
#if TEST_CODE
namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
[NUnit.Framework.Ignore("Ignoring test due to race condition")]
public void MainThreadExit()
{
StartTest("MainThreadExit.cs");
ObjectDump("ThreadsBeforeExit", process.Threads);
process.AsyncContinue();
System.Threading.Thread.Sleep(250);
process.Break();
ObjectDump("ThreadsAfterExit", process.Threads);
process.Terminate();
EndTest();
}
}
}
#endif
#if EXPECTED_OUTPUT
mscorlib.dll (No symbols)
MainThreadExit.exe (Has symbols)
Break MainThreadExit.cs:23,4-23,40
-
-
ForcedBreak MainThreadExit.cs:28,4-28,26
-
-
#endif // EXPECTED_OUTPUT