how avoid delay while returning from C-python api?

L

Lakshmipathi.G

Hi -

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
<snip>
offset=0
size=4
write_object(offset,size)
</snip>


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, &size))
Py_RETURN_NONE;

printf("before call");
write_this_c(offset, size);
printf("after call");
Py_RETURN_NONE; ##delay happens here
}

How to avoid this delay time? Thanks for any help/pointers!


----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,053
Messages
2,570,431
Members
47,075
Latest member
TysonV438

Latest Threads

Top