Author: ArcRiley
Date: 2009-01-03 19:09:52 -0500 (Sat, 03 Jan 2009)
New Revision: 1416

Modified:
   trunk/concordance/setup.py
   trunk/concordance/src/__init__.c
Log:
Initialize glib threading, link the glib libraries


Modified: trunk/concordance/setup.py
===================================================================
--- trunk/concordance/setup.py  2009-01-03 23:49:31 UTC (rev 1415)
+++ trunk/concordance/setup.py  2009-01-04 00:09:52 UTC (rev 1416)
@@ -51,6 +51,9 @@
     include_dirs   = ['/usr/include/glib-2.0',
                       '/usr/lib/glib-2.0/include',
     ],
+    libraries      = ['glib-2.0',
+                      'gthread-2.0',
+    ],
   )],
   classifiers      = [
     'Development Status :: 1 - Planning',

Modified: trunk/concordance/src/__init__.c
===================================================================
--- trunk/concordance/src/__init__.c    2009-01-03 23:49:31 UTC (rev 1415)
+++ trunk/concordance/src/__init__.c    2009-01-04 00:09:52 UTC (rev 1416)
@@ -20,6 +20,7 @@
 */
 
 #include "Python.h"
+#include "glib.h"
 #include "Core.h"
 
 static PyMethodDef concordanceMethods[] = {
@@ -43,6 +44,20 @@
   cdef :                                                                  \*/
     PyObject* module;
 
+  /* Initialize Glib threading support
+
+     gboolean  g_thread_supported  ();
+       This function returns TRUE if the thread system is initialized, and 
+       FALSE if it is not. 
+
+     void      g_thread_init       (GThreadFunctions *vtable);
+       If you use GLib from more than one thread, you must initialize the 
+       thread system by calling g_thread_init(). Most of the time you will 
+       only have to call g_thread_init (NULL).
+  */
+  if (!g_thread_supported()) g_thread_init(NULL);
+
+
   /* Initialize all types prior to module creation
 
      int PyType_Ready(PyTypeObject*)
@@ -53,12 +68,14 @@
   */
   if (PyType_Ready(&conCore_Type) < 0) return NULL;
 
+
   /* Create concordance module object
 
      PyObject* PyModule_Create(struct PyModuleDef*)
   */
   module = PyModule_Create(&concordanceModule);
 
+
   /* Add Core class to the concordance module object
 
      int PyModule_AddObject(PyObject*, const char*, PyObject*);
@@ -66,5 +83,6 @@
   Py_INCREF(&conCore_Type);
   PyModule_AddObject(module, "Core", (PyObject*) &conCore_Type);
 
+
   return module;
 }

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to