1 |
pacho 11/01/28 19:39:18 |
2 |
|
3 |
Added: pygobject-2.26.0-disabled-threads.patch |
4 |
Log: |
5 |
Fix building without threads and dependency on python (thanks a lot to Arfrever Frehtes Taifersar Arahesis for his help). |
6 |
|
7 |
(Portage version: 2.1.9.35/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-python/pygobject/files/pygobject-2.26.0-disabled-threads.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pygobject/files/pygobject-2.26.0-disabled-threads.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pygobject/files/pygobject-2.26.0-disabled-threads.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: pygobject-2.26.0-disabled-threads.patch |
16 |
=================================================================== |
17 |
From a4b210d69c832629894090b7154ae194209b0c60 Mon Sep 17 00:00:00 2001 |
18 |
From: Arnaud Charlet <charlet@×××××××.com> |
19 |
Date: Tue, 18 Jan 2011 17:31:29 +0000 |
20 |
Subject: Disable calls to PyGILState_* when threads are disabled |
21 |
|
22 |
Since threads may also be disabled in Python too, those symbols may not |
23 |
be resolved. |
24 |
|
25 |
https://bugzilla.gnome.org/show_bug.cgi?id=374603 |
26 |
--- |
27 |
diff --git a/glib/pyglib.c b/glib/pyglib.c |
28 |
index 8163e88..1e024c2 100644 |
29 |
--- a/glib/pyglib.c |
30 |
+++ b/glib/pyglib.c |
31 |
@@ -94,7 +94,11 @@ pyglib_gil_state_ensure(void) |
32 |
if (!_PyGLib_API->threads_enabled) |
33 |
return PyGILState_LOCKED; |
34 |
|
35 |
+#ifdef DISABLE_THREADING |
36 |
+ return PyGILState_LOCKED; |
37 |
+#else |
38 |
return PyGILState_Ensure(); |
39 |
+#endif |
40 |
} |
41 |
|
42 |
void |
43 |
@@ -105,7 +109,9 @@ pyglib_gil_state_release(PyGILState_STATE state) |
44 |
if (!_PyGLib_API->threads_enabled) |
45 |
return; |
46 |
|
47 |
+#ifndef DISABLE_THREADING |
48 |
PyGILState_Release(state); |
49 |
+#endif |
50 |
} |
51 |
|
52 |
/** |
53 |
@@ -171,13 +177,19 @@ _pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback) |
54 |
int |
55 |
pyglib_gil_state_ensure_py23 (void) |
56 |
{ |
57 |
+#ifdef DISABLE_THREADING |
58 |
+ return 0; |
59 |
+#else |
60 |
return PyGILState_Ensure(); |
61 |
+#endif |
62 |
} |
63 |
|
64 |
void |
65 |
pyglib_gil_state_release_py23 (int flag) |
66 |
{ |
67 |
+#ifndef DISABLE_THREADING |
68 |
PyGILState_Release(flag); |
69 |
+#endif |
70 |
} |
71 |
|
72 |
/** |
73 |
diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h |
74 |
index ae4cfe1..a928cb1 100644 |
75 |
--- a/gobject/pygobject-private.h |
76 |
+++ b/gobject/pygobject-private.h |
77 |
@@ -32,12 +32,18 @@ extern struct _PyGObject_Functions pygobject_api_functions; |
78 |
|
79 |
#define pyg_threads_enabled (pygobject_api_functions.threads_enabled) |
80 |
|
81 |
+#ifdef DISABLE_THREADING |
82 |
+#define pyg_gil_state_ensure() 0 |
83 |
+#define pyg_gil_state_release(state) G_STMT_START { \ |
84 |
+ } G_STMT_END |
85 |
|
86 |
+#else |
87 |
#define pyg_gil_state_ensure() (pygobject_api_functions.threads_enabled? (PyGILState_Ensure()) : 0) |
88 |
#define pyg_gil_state_release(state) G_STMT_START { \ |
89 |
if (pygobject_api_functions.threads_enabled) \ |
90 |
PyGILState_Release(state); \ |
91 |
} G_STMT_END |
92 |
+#endif |
93 |
|
94 |
#define pyg_begin_allow_threads \ |
95 |
G_STMT_START { \ |
96 |
-- |
97 |
cgit v0.8.3.1 |