[Vala] Singleton question



I used the singleton pattern. For now it has worked.
My question is: How can I make it//// thread-safe with Glib?
________________
using GLib;

public class CSingleton : Object
{
   private static CSingleton Instance = null;

   private static void CreateInstance ()
   {
       if (Instance == null)
       {
           Instance = new CSingleton ();
       }
   }

   public static CEscena Get_Instance ()
   {
       if (Instance == null) CreateInstance ();
       return Instance;
   }
}
________________
......

CSingleton singleton = Get_Instance ();

________________



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]