Ejemplo n.º 1
0
        public static void DoHardWorkThreadSafety()
        {
            ThreadSafeLoggerSingleton logger    = ThreadSafeLoggerSingleton.GetInstance();
            HardProcessor             processor = new HardProcessor(1);

            logger.Log("Thread safe hard work started...");
            processor.ProcessTo(5);
            logger.Log("Thread safe hard work finished...");
        }
Ejemplo n.º 2
0
 public static ThreadSafeLoggerSingleton GetInstance()
 {
     lock (locker)
     {
         if (_loggerInstance == null)
         {
             _loggerInstance = new ThreadSafeLoggerSingleton();
         }
     }
     return(_loggerInstance);
 }