I have C-Python API like below. It works fine, but the problem is while invoking this method from python script say
#cat script.py
offset=0
size=4
write_object(offset,size)
This calls write_this_c() C api and returns quickly to next printf statement. But the return call (Py_RETURN_NONE) takes something like 4-6 seconds.
static
PyMethodDef xyz_methods[] = {
{"write_object", write_object, METH_VARARGS,"write some stuff "},
{NULL, NULL, 0, NULL}
};
....
static PyObject *
write_object(PyObject *self, PyObject *args)
{
int offset, size;
if (!PyArg_ParseTuple(args,"ii", &offset,
printf("before call");
write_this_c(offset, size);
printf("after call");
Py_RETURN_NONE; ##delay happens here
}
How to avoid this delay time?