This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] fix for thread-less python


I think this patch should suffice to let us build python-gdb even when
python was configured without thread support.

Now I think part of the first thread safety patch could be extracted
and sent upstream.  I'll do this soon, assuming it won't hurt Thiago's
efforts.

Tom

2008-11-19  Tom Tromey  <tromey@redhat.com>

	* python/python-internal.h (PyGILState_Ensure): New define.
	(PyGILState_Release): Likewise.
	(PyEval_InitThreads): Likewise.
	(PyThreadState_Swap): Likewise.
	(PyEval_InitThreads): Likewise.

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 88f438d..e85548e 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -46,6 +46,17 @@ typedef int Py_ssize_t;
 #error "Unable to find usable Python.h"
 #endif
 
+/* If Python.h does not define WITH_THREAD, then the various
+   GIL-related functions will not be defined.  However,
+   PyGILState_STATE will be.  */
+#ifndef WITH_THREAD
+#define PyGILState_Ensure() ((PyGILState_STATE) 0)
+#define PyGILState_Release(ARG) (ARG)
+#define PyEval_InitThreads() 0
+#define PyThreadState_Swap(ARG) (ARG)
+#define PyEval_InitThreads() 0
+#endif
+
 #include "command.h"
 
 struct block;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]