Call g_thread_init to make libsoup happy
authorColin Walters <walters@src.gnome.org>
Sun, 7 Sep 2008 22:10:37 +0000 (22:10 +0000)
committerColin Walters <walters@src.gnome.org>
Sun, 7 Sep 2008 22:10:37 +0000 (22:10 +0000)
* giscanner/cgobject.py: Also call g_thread_init.

svn path=/trunk/; revision=583

giscanner/cgobject.py

index 2040cd3882a9f6733ea200cfdac66a52ebffa7fb..f15d1717498e35f3408daf0ad139c319d02ce208 100644 (file)
@@ -134,6 +134,15 @@ if not _library_path:
 _gobj = ctypes.CDLL(_library_path, ctypes.RTLD_GLOBAL)
 _gobj.g_type_init()
 
+if os.name == 'nt':
+    _threads_library_path = find_library('libgthread-2.0-0')
+else:
+    _threads_library_path = find_library('gthread-2.0')
+if not _threads_library_path:
+    raise ImportError("Could not find gthread-2.0 library")
+_gthreads = ctypes.CDLL(_threads_library_path, ctypes.RTLD_GLOBAL)
+_gthreads.g_thread_init.argtypes = [ctypes.c_void_p]
+_gthreads.g_thread_init(None)
 
 # Functions