public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* [python] acquire GIL when removing objfile
@ 2009-04-01  0:22 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2009-04-01  0:22 UTC (permalink / raw)
  To: Project Archer

I'm checking this in on the python branch.

While prepping the objfile work for submission upstream, I noticed a
callback that was not acquiring the GIL.

Tom

2009-03-31  Tom Tromey  <tromey@redhat.com>

	* python/python-objfile.c (clean_up_objfile): Acquire and release
	GIL.

diff --git a/gdb/python/python-objfile.c b/gdb/python/python-objfile.c
index e97d3a2..f5db084 100644
--- a/gdb/python/python-objfile.c
+++ b/gdb/python/python-objfile.c
@@ -116,9 +116,13 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
 static void
 clean_up_objfile (struct objfile *objfile, void *datum)
 {
+  PyGILState_STATE state;
   objfile_object *object = datum;
+
+  state = PyGILState_Ensure ();
   object->objfile = NULL;
   Py_DECREF ((PyObject *) object);
+  PyGILState_Release (state);
 }
 
 /* Return the Python object of type Objfile representing OBJFILE.  If

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-01  0:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-01  0:22 [python] acquire GIL when removing objfile Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).