Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simple syncronization test written by sp.

svn path=/trunk/winforms/; revision=55461
  • Loading branch information...
commit b18322066a4bdfbfb32f1eca2088fc545eec21cb 1 parent 48ec5bb
Jackson Harper authored
Showing with 53 additions and 0 deletions.
  1. +10 −0 timers/Makefile
  2. +43 −0 timers/swf-timers.cs
View
10 timers/Makefile
@@ -0,0 +1,10 @@
+all: mono
+
+mono: swf-timers.cs
+ mcs swf-timers.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
+
+dotnet: swf-timers.cs
+ csc swf-timers.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
+
+clean:
+ rm swf-timers.exe -r -f
View
43 timers/swf-timers.cs
@@ -0,0 +1,43 @@
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Timers;
+using System.Windows.Forms;
+
+class Program {
+
+ static void ShowStackTrace (object o, ElapsedEventArgs e)
+ {
+ Console.WriteLine (counter);
+ Console.WriteLine ("Threads Equal: {0}", System.Threading.Thread.CurrentThread == startup_thread);
+ if (counter++ > 5) {
+ t.AutoReset = false;
+ t.Enabled = false;
+ }
+ }
+
+ static System.Threading.Thread startup_thread;
+ static System.Timers.Timer t;
+ static int counter = 0;
+
+ static void Main (string[] args)
+ {
+ bool so = (args.Length > 0);
+ Label label = new Label ();
+
+ Console.WriteLine ("STARTUP THREAD: " + System.Threading.Thread.CurrentThread.GetHashCode ());
+ startup_thread = System.Threading.Thread.CurrentThread;
+
+ t = new System.Timers.Timer (500);
+ if (so)
+ t.SynchronizingObject = label;
+ t.Elapsed += new ElapsedEventHandler (ShowStackTrace);
+ t.AutoReset = true;
+ t.Enabled = true;
+
+ System.Threading.Thread.Sleep (5000);
+ }
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.