Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Timer2
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Timers; namespace Rextester { class Program { static TimeSpan t1 = TimeSpan.FromMilliseconds(20); static DateTime t2_now; static TimeSpan t3_temp = TimeSpan.FromMilliseconds(0); static int count = 0; public static void Main(string[] args) { Thread myThread = new Thread(func); //Создаем новый объект потока (Thread) t2_now = DateTime.Now; myThread.Start(); //запускаем поток for (int i = 0; i < 10; i++ ) { // Console.WriteLine("Поток 1 выводит " + t1 + " t2_now = " + t2_now.Millisecond); Thread.Sleep(0); } do { t3_temp += TimeSpan.FromMilliseconds(1) ; if (t3_temp> t1) t3_temp = TimeSpan.FromMilliseconds(0); Console.WriteLine("Внутри while " + t3_temp + " t1" + t1); }while (count < 5); Console.Read(); //Приостановим основной поток } static void func() { for (int i = 0; i < 10; i++) { // Console.WriteLine("Поток 2 выводит " + i.ToString()); Thread.Sleep(0); } } } }
run
|
edit
|
history
|
help
0
C# Dictionary with Enum Keys And Values
asdxsaszxasdf
Trials
Char To Image
Explorer Diamond
Vin Generator V1
aaaaa
Using Yield Return to mass copy a Class instance
Find 20 business days prior to today's date c#
123