Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Volatile madness
//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.Threading.Tasks; namespace Rextester { public class Program { // Дорогой фриман, убери слово volatile и поведение проги изменится, вот увидишь private volatile bool flag = true; private void run() { Task.Factory.StartNew(resetFlagAfter1s); int x = 0; while (flag)++x; Console.WriteLine("Done"); } private void resetFlagAfter1s() { Thread.Sleep(1000); flag = false; } public static void Main(String[] a) { new Program().run(); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Basic classes
Base
Hack
Reverse String in for loop
Addition
Daily Coding Problem: Problem #1
subtração
DotnetQ6
//Json Get Field from Array
іфи
Please log in to post a comment.