summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2005-02-08 02:07:57 (GMT)
committerGuido van Rossum <guido@python.org>2005-02-08 02:07:57 (GMT)
commit0f1f63cf07f654bfae6de0c99b2a885fc38a2174 (patch)
tree10c22899d1318483897bd20b87002b528431ed16 /Python/pystate.c
parent7fcb7869ba82586f68e0cf28c3a25e78457fa0e0 (diff)
downloadcpython-0f1f63cf07f654bfae6de0c99b2a885fc38a2174.zip
cpython-0f1f63cf07f654bfae6de0c99b2a885fc38a2174.tar.gz
cpython-0f1f63cf07f654bfae6de0c99b2a885fc38a2174.tar.bz2
Close the discussion in SF bug 1069160.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 1825607..255cf7e 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -320,7 +320,7 @@ PyThreadState_GetDict(void)
/* Asynchronously raise an exception in a thread.
Requested by Just van Rossum and Alex Martelli.
- To prevent naive misuse, you must write your own exception
+ To prevent naive misuse, you must write your own extension
to call this. Must be called with the GIL held.
Returns the number of tstates modified; if it returns a number
greater than one, you're in trouble, and you should call it again
@@ -332,6 +332,7 @@ PyThreadState_SetAsyncExc(long id, PyObject *exc) {
PyInterpreterState *interp = tstate->interp;
PyThreadState *p;
int count = 0;
+ HEAD_LOCK();
for (p = interp->tstate_head; p != NULL; p = p->next) {
if (p->thread_id != id)
continue;
@@ -340,6 +341,7 @@ PyThreadState_SetAsyncExc(long id, PyObject *exc) {
p->async_exc = exc;
count += 1;
}
+ HEAD_UNLOCK();
return count;
}