From 21cd2dfc1472db13d2bd850faf17c42e83b5102f Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Fri, 30 Dec 2005 12:14:59 +0000 Subject: [PATCH] 2005-12-30 Alp Toker * Thread.cs: Add GLib.Thread.Supported, should be checked to avoid doing Thread.Init() twice (Mono runtime initialises GLib threads itself, MS runtime doesn't) * glue/thread.c: g_thread_supported() is a macro, so needs glue * glue/Makefile.am: * glue/makefile.win32: Update makefiles with new glue file. svn path=/trunk/gtk-sharp/; revision=54926 --- ChangeLog | 9 +++++++++ glib/Thread.cs | 10 ++++++++++ glib/glue/Makefile.am | 3 ++- glib/glue/makefile.win32 | 1 + glib/glue/thread.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 glib/glue/thread.c diff --git a/ChangeLog b/ChangeLog index ad1ea82fe..ea89e324f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-12-30 Alp Toker + + * Thread.cs: Add GLib.Thread.Supported, should be checked to avoid doing + Thread.Init() twice (Mono runtime initialises GLib threads itself, MS + runtime doesn't) + * glue/thread.c: g_thread_supported() is a macro, so needs glue + * glue/Makefile.am: + * glue/makefile.win32: Update makefiles with new glue file. + 2005-12-21 Lluis Sanchez Gual * generator/FieldBase.cs: Properly convert marshalled value diff --git a/glib/Thread.cs b/glib/Thread.cs index e2609c913..25097e6fa 100644 --- a/glib/Thread.cs +++ b/glib/Thread.cs @@ -35,5 +35,15 @@ namespace GLib { g_thread_init (IntPtr.Zero); } + + [DllImport("glibsharpglue-2")] + static extern bool glibsharp_g_thread_supported (); + + public static bool Supported + { + get { + return glibsharp_g_thread_supported (); + } + } } } diff --git a/glib/glue/Makefile.am b/glib/glue/Makefile.am index fe0b98099..b95ae7a71 100644 --- a/glib/glue/Makefile.am +++ b/glib/glue/Makefile.am @@ -10,7 +10,8 @@ libglibsharpglue_2_la_SOURCES = \ type.c \ unichar.c \ value.c \ - valuearray.c + valuearray.c \ + thread.c # Adding a new glue file? # Please remember to update makefile.win32 diff --git a/glib/glue/makefile.win32 b/glib/glue/makefile.win32 index 4b396b012..3ac9fe86e 100755 --- a/glib/glue/makefile.win32 +++ b/glib/glue/makefile.win32 @@ -12,6 +12,7 @@ GLUE_OBJS = \ unichar.o \ value.o \ valuearray.o \ + thread.o \ win32dll.o all: glibsharpglue-2.dll diff --git a/glib/glue/thread.c b/glib/glue/thread.c new file mode 100644 index 000000000..5827d885d --- /dev/null +++ b/glib/glue/thread.c @@ -0,0 +1,30 @@ +/* list.c : Glue to access fields in GList. + * + * Author: Alp Toker + * + * Copyright (c) 2005 Alp Toker + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the Lesser GNU General + * Public License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#include + +gboolean +glibsharp_g_thread_supported () +{ + return g_thread_supported (); +} +