5 spam_busy(PyObject *self, PyObject *args)
9 if (!PyArg_ParseTuple(args, "l", &count))
11 Py_BEGIN_ALLOW_THREADS
12 for (i = 0; i < count; i++)
15 return PyLong_FromLong(i);
18 static PyMethodDef SpamMethods[] = {
19 {"busy", spam_busy, METH_VARARGS,
20 "Drop the GIL and run a busy wait until you count to `count`."},
21 {NULL, NULL, 0, NULL} /* Sentinel */
24 static struct PyModuleDef spammodule = {
25 PyModuleDef_HEAD_INIT,
26 "spam", /* name of module */
27 NULL, /* module documentation, may be NULL */
28 0, /* size of per-interpreter state of the module */
35 return PyModule_Create(&spammodule);