[Vala] Singleton question
- From: "José D. Abad" <granveoduendes gmail com>
- To: vala-list gnome org
- Subject: [Vala] Singleton question
- Date: Wed, 29 Oct 2008 06:28:30 +0100
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]