Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- namespace MoreMethodExercises
- {
- class Program
- {
- static bool done;
- static readonly object locker = new object();
- static void Main(string[] args)
- {
- new Thread(Go).Start();
- Go();
- }
- static void Go()
- {
- lock (locker)
- {
- if (!done)
- {
- Console.WriteLine("Done");
- done = true;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment