Re: [Vala] Singleton question



You can take a look at this: http://live.gnome.org/Vala/Tutorial#head-a81a520acce1ad8622b8a2f895177b9765a69841

Also, maybe you should read this: http://steve.yegge.googlepages.com/singleton-considered-stupid

--
Ali

On Wed, Oct 29, 2008 at 6:28 AM, "José D. Abad" <granveoduendes gmail com> wrote:
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 ();

________________
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



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