public class MultiThreadExceptionTest {
public static int result = 0;
+ public static object started = new object ();
public static void ThreadStart1 () {
Console.WriteLine("{0} started",
try {
try {
try {
+ lock (started) {
+ Monitor.Pulse (started);
+ }
int i = 0;
try {
while (true) {
}
public static int Main() {
-
// Check aborting the current thread
bool aborted = false;
try {
if (!aborted)
return 2;
- Thread t1 = new Thread(new ThreadStart
- (MultiThreadExceptionTest.ThreadStart1));
- t1.Name = "Thread 1";
+ Thread t1 = null;
- Thread.Sleep (100);
-
- t1.Start();
+ lock (started) {
+ t1 = new Thread(new ThreadStart
+ (MultiThreadExceptionTest.ThreadStart1));
+ t1.Name = "Thread 1";
+
+ Thread.Sleep (100);
- Thread.Sleep (200);
+ t1.Start();
+
+ Monitor.Wait (started);
+ }
+
+ Thread.Sleep (100);
+
t1.Abort ("STATETEST");
t1.Join ();
- Console.WriteLine ("Result: " + result);
- if (result != 59)
+ if (result != 59) {
+ Console.WriteLine ("Result: " + result);
return 1;
+ }
// Test from #68552
try {