Esempio n. 1
0
        static void Main(string[] args)
        {
            Task task  = Task.Factory.StartNew(() => PersonaDB.GetInstance().Listening());
            Task task2 = Task.Factory.StartNew(() => {
                List <Persona> personas = PersonaDB.GetInstance().Get();
                Util.Print(personas);
            });

            Task.WaitAll(task, task2);
            Console.WriteLine("All threads complete");
        }
Esempio n. 2
0
 public static PersonaDB GetInstance()
 {
     if (_instance == null)
     {
         lock (padlock)
         {
             if (_instance == null)
             {
                 _instance = new PersonaDB();
             }
         }
     }
     return(_instance);
 }