Esempio n. 1
0
        public static string GetTime()
        {
            if (_instance == null)
            {
                lock (key)
                {
                    if (_instance == null)
                    {
                        _instance = new IsraelTime();
                    }
                }
            }

            return(_instance.timeIL);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine($"Time in Israel is {IsraelTime.GetTime()}");
            AsyncPrinter async = new AsyncPrinter();

            for (int i = 0; i < 10; i++)
            {
                new Thread(() => async.CheckPrintMessage()).Start();
            }
            for (int i = 0; i < 100; i++)
            {
                async.AddMessage(IsraelTime.GetTime());
                Thread.Sleep(100);
            }
        }