Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- namespace VolatileTest
- {
- class Program
- {
- static void Main()
- {
- Test.TestVolatile();
- }
- }
- class Test
- {
- int foo;
- public static void TestVolatile()
- {
- var test = new Test();
- new Thread(delegate() { Thread.Sleep(500); test.foo = 255; }).Start();
- while (test.foo != 255) ;
- Console.WriteLine("OK");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement