📅  最后修改于: 2022-03-11 15:05:31.905000             🧑  作者: Mango
#include
static void gen_nums() {
int i;
for(i = 0; i < 10; i++) {
printf("Printed from C thread...\n");
Sleep(1000);
}
}
static PyMethodDef gen_numsmethods[] = {
{"gen_nums", gen_nums, METH_VARARGS, "This is a threading test"},
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef threadmod = {
PyModuleDef_HEAD_INIT,
"threadrun",
"This is a thread test module",
-1,
gen_numsmethods
};
PyMODINIT_FUNC PyInit_threadrun(void) {
return PyModule_Create(&threadmod);
}