コード例 #1
0
ファイル: Main.cs プロジェクト: theWornOut/Argeset
        static void Add(object data)
        {
            if (data is AddParams)
            {
                Console.WriteLine("ID of Thread in Add(): {0}", Thread.CurrentThread.ManagedThreadId);
                AddParams ap = (AddParams)data;
                Console.WriteLine("{0} + {1} is {2}", ap.a, ap.b, ap.a + ap.b);

                waitHandle.Set();
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: neziry/Argeset
		public static void Main (string[] args)
		{
			Console.WriteLine ("** Adding with Thread Objects **");
			Console.WriteLine("ID of thread in Main(): {0}",Thread.CurrentThread.ManagedThreadId);

			AddParams ap = new AddParams(10, 10);
			Thread t = new Thread(new ParameterizedThreadStart(Add));
			t.Start(ap);

			waitHandle.WaitOne();
			Console.WriteLine("Other thread is done");
		}
コード例 #3
0
ファイル: Main.cs プロジェクト: theWornOut/Argeset
        public static void Main(string[] args)
        {
            Console.WriteLine("** Adding with Thread Objects **");
            Console.WriteLine("ID of thread in Main(): {0}", Thread.CurrentThread.ManagedThreadId);

            AddParams ap = new AddParams(10, 10);
            Thread    t  = new Thread(new ParameterizedThreadStart(Add));

            t.Start(ap);

            waitHandle.WaitOne();
            Console.WriteLine("Other thread is done");
        }