summaryrefslogtreecommitdiff
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-19 23:58:51 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-19 23:58:51 +0200
commit87c4bc18d9591c89d76f68cbd67960d2a1309075 (patch)
tree620966a9b67c9eb1aaf9212f72818c47104ecfd0 /Modules/_threadmodule.c
parent31f0922dfc65b5c2f9ba835392872b5f46115c07 (diff)
downloadcpython-87c4bc18d9591c89d76f68cbd67960d2a1309075.tar.gz
Issue #11223: Add threading._info() function providing informations about the
thread implementation. Skip test_lock_acquire_interruption() and test_rlock_acquire_interruption() of test_threadsignals if a thread lock is implemented using a POSIX mutex and a POSIX condition variable. A POSIX condition variable cannot be interrupted by a signal (e.g. on Linux, the futex system call is restarted).
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index ef17b2845c..914d671d6a 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1221,13 +1221,22 @@ requiring allocation in multiples of the system memory page size\n\
(4kB pages are common; using multiples of 4096 for the stack size is\n\
the suggested approach in the absence of more specific information).");
+static PyObject *
+thread_info(PyObject *self)
+{
+ return _PyThread_Info();
+}
+
+PyDoc_STRVAR(thread_info_doc,
+"info() -> dict\n\
+\n\
+Informations about the thread implementation.");
+
static PyMethodDef thread_methods[] = {
{"start_new_thread", (PyCFunction)thread_PyThread_start_new_thread,
- METH_VARARGS,
- start_new_doc},
+ METH_VARARGS, start_new_doc},
{"start_new", (PyCFunction)thread_PyThread_start_new_thread,
- METH_VARARGS,
- start_new_doc},
+ METH_VARARGS, start_new_doc},
{"allocate_lock", (PyCFunction)thread_PyThread_allocate_lock,
METH_NOARGS, allocate_doc},
{"allocate", (PyCFunction)thread_PyThread_allocate_lock,
@@ -1243,8 +1252,9 @@ static PyMethodDef thread_methods[] = {
{"_count", (PyCFunction)thread__count,
METH_NOARGS, _count_doc},
{"stack_size", (PyCFunction)thread_stack_size,
- METH_VARARGS,
- stack_size_doc},
+ METH_VARARGS, stack_size_doc},
+ {"info", (PyCFunction)thread_info,
+ METH_NOARGS, thread_info_doc},
{NULL, NULL} /* sentinel */
};
@@ -1310,7 +1320,7 @@ PyInit__thread(void)
d = PyModule_GetDict(m);
ThreadError = PyExc_RuntimeError;
Py_INCREF(ThreadError);
-
+
PyDict_SetItemString(d, "error", ThreadError);
Locktype.tp_doc = lock_doc;
Py_INCREF(&Locktype);